Page 1 of 1

php-include on the blog page

Posted: Wed Dec 21, 2005 3:33 am
by ppalazzo
I have a blog:
http://www.palazzo.arq.br

I really tried to get a hang of Smarty. But, after weeks of struggle, it still looked like Greek to me, so I resorted to editing the index.php file to customize my blog.

Now, there are some static pages I'd like to display where the blog entries are. So I tried something like this:

Code: Select all

		<?php
		if ($_REQUEST['pag'] = 'blog') {
			echo $blog_data;
		} else {
			$_REQUEST['pag'] = $_GET['pag'];
			$pagename = $_REQUEST['pag'];
			$filename = $pagename.'.php';
			include $filename;
		}
		?>
But it doesn't seem to be working. Also, when I set up a wrapper (creating a wrapper.php and setting it as the home page on the admin control panel), Serendipity disregards it and loads index.php anyway. What am I doing wrong?

Re: php-include on the blog page

Posted: Wed Dec 21, 2005 3:58 am
by garvinhicking
Actually what you try to do with a wrapper isn't that suggested at all.

Try to use the wrapurl or externalphp plugin instead! They offer you to wrap foreign applications within the blog layout.

Or try to use the staticpage plugin!

Best regards,
Garvin

Posted: Thu Dec 22, 2005 6:28 pm
by ppalazzo
Staticpage is great! But where should I put the config file that enables Serendipity to parse php commands?

Posted: Thu Dec 22, 2005 6:31 pm
by garvinhicking
What do you mean? The template's config.inc.php file where you can put PHP code? Or how to use PHP within Smarty Templates? Or how to put Smarty markup inside a staticpage entry?

Regards,
Garvin

Posted: Thu Dec 22, 2005 9:33 pm
by ppalazzo
Out of the box (so to speak), StaticPage does not allow php commands to be parsed as such, so that when I insert some php code into the page what I get at the output is the code printed out on the screen, not the result of the command. Is this because StaticPage uses a Smarty *.tpl file to output the static pages? If so, I believe someone on this forum taught a way to include a config.inc.php file with a command to remove this security lockdown which prevents php code from being parsed. My question is, where should this file go: inside the /serendipity/Plugins/StaticPage folder, or at the root /serendipity/ ?

Posted: Thu Dec 22, 2005 9:40 pm
by garvinhicking
Yes, PHP code within entries is always a very large security risk, which is why we don't allow it.

And yes, static pages use the smarty templating system.

And yes, you can install the Smarty markup plugin to put Smarty markup in your static pages. And then you can also bypass the smarty security. Put the config.inc.php file with that code of the forum thread within your template directory. (like templates/mytemplate/config.inc.php)

Regards,
Garvin

Posted: Thu Dec 22, 2005 10:58 pm
by ppalazzo
Thanks!