php-include on the blog page

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
ppalazzo
Regular
Posts: 10
Joined: Sun Sep 26, 2004 5:38 am

php-include on the blog page

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: php-include on the blog page

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ppalazzo
Regular
Posts: 10
Joined: Sun Sep 26, 2004 5:38 am

Post by ppalazzo »

Staticpage is great! But where should I put the config file that enables Serendipity to parse php commands?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ppalazzo
Regular
Posts: 10
Joined: Sun Sep 26, 2004 5:38 am

Post 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/ ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ppalazzo
Regular
Posts: 10
Joined: Sun Sep 26, 2004 5:38 am

Post by ppalazzo »

Thanks!
Post Reply