Page 1 of 1
execute php code in html nugget ?
Posted: Thu Aug 31, 2006 11:49 am
by pidee
hi,
how can php be executed in a html-nugget ?
i'm trying to echo a "simple text" as a test
<?php echo "simple text"; ?>
echo "simple text";
{php}echo "simple text";{/php}
neither one does the trick...
tia,
p.
Re: execute php code in html nugget ?
Posted: Thu Aug 31, 2006 11:52 am
by garvinhicking
Hi!
PHP-Code cannot be executed there as it would impose a huge security risk. You should build your own plugins, or use the "Include PHP script / External Code" sidebar nugget, where you can specify an external PHP script.
Or you search this forum for the php nugget. But it is not recommended.
The other option is to install the smartymarkup plugin, then you can use thise {php} markup in your nugget. But only if you also disable the smarty security setting in include/functions_smarty.inc.php or your templates config.inc.php via $serendipity['smarty']->security = false;
Best regards,
Garvin
Re: execute php code in html nugget ?
Posted: Thu Aug 31, 2006 12:18 pm
by pidee
garvinhicking wrote:Hi!
or use the "Include PHP script / External Code" sidebar nugget, where you can specify an external PHP script.
thanks Garvin but where do i find that script... i dont find it on the s9y site, and i dont find it on sourceforge...
p.
Re: execute php code in html nugget ?
Posted: Thu Aug 31, 2006 12:20 pm
by garvinhicking
Hi!
thanks Garvin but where do i find that script... i dont find it on the s9y site, and i dont find it on sourceforge...
You can find it here on the forums. I can'T say much more, because I really don't advocate its use.
Regards,
Garvin
Posted: Thu Aug 31, 2006 12:50 pm
by pidee
i dont understand that smarty thingie... so i am limited to using that external code script...
Posted: Thu Aug 31, 2006 2:00 pm
by garvinhicking
Hi!
Yeah, but that's quite easy. Just upload your PHP script and include it.
Regards,
Garvin
Posted: Sat Sep 02, 2006 5:53 pm
by pidee
can someoneplease point me to that plugin cause in dont seem to be able to find it on this site...
...
p.
Posted: Sat Sep 02, 2006 7:31 pm
by mgroeninger
Posted: Sat Sep 02, 2006 9:47 pm
by pidee
ok, i know eval is supposed to be avoided...
so i'm willing to give it a go at writing my own SIMPLE plugin..
lets take the code mentioned in the post above and lets say i just want to do a echo can i then change this code :
Code: Select all
function generate_content(&$title, $output = true)
{
$title = $this->get_config('title', $title);
if ($output) eval($this->get_config('content'));
}
into this :
Code: Select all
function generate_content(&$title, $output = true)
{
$title = $this->get_config('title', $title);
echo "this is a test";
}
... i guess not, because it isnt working...
any thaughts or pointers ?[/quote]
Posted: Sun Sep 03, 2006 3:05 pm
by garvinhicking
Hi!
Yes, you can. What is not working? How does your full plugin look like? You did install the plugin through the interface, right? Without installing a plugin, nothing will happen?
Regards,
Garvin
Posted: Sun Sep 03, 2006 11:02 pm
by pidee
garvinhicking wrote:Hi!
Yes, you can. What is not working? How does your full plugin look like? You did install the plugin through the interface, right? Without installing a plugin, nothing will happen?
Regards,
Garvin
i just took the file mgroeninger linked me to, and changed 1 line as I posted...
in fact all i want is to be able to include my own log.php file... so i can count visitors...
i'm sure someone (smarter then me) must have done this before ?
Posted: Mon Sep 04, 2006 10:18 am
by garvinhicking
Hi!
So you installed the plugin and have it in your plugin configuration panel as a sidebar item? And on your frontpage, it does not display anything? Try to put a "return true;" inside the generate_content() method?
Please paste your full current plugin file, then I can tell you what's wrong. You are definitely on the right path, it must be a minor issue.
Best regards,
Garvin
Posted: Mon Sep 04, 2006 4:21 pm
by pidee
ah, never mind, i give up.
anyway, thanks for your time
p.
Posted: Mon Sep 04, 2006 9:10 pm
by garvinhicking
Hi!
Okay, I'm sorry. Luck will come to those who wait.
Best regards,
Garvin