php includes in tpl files

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
netdominus
Posts: 4
Joined: Sun May 27, 2007 7:24 pm

php includes in tpl files

Post by netdominus »

I have searched in the forums, but can't find anything on this...

I would like to have a php include

Code: Select all

<?php include ('../ssi/quotes/rotate.php') ?>
in the index.tpl file, but if I add the code directly, the entire block disappears. I have tried creating a variable in the language file and adding it to the array declaration in the index.php file, but all that happens is that the code is dropped into the web-page, rather than being resolved.

I am sure this isn't such an unusual request - can anyone help?
Thorsten
Posts: 15724
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

we supported this in phpMyFAQ 1.6 and we removed that for security reasons in 2.0.

You should add an template placeholder and set the PHP code for that in the PHP file.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
netdominus
Posts: 4
Joined: Sun May 27, 2007 7:24 pm

Are there guidance notes on how to do this?

Post by netdominus »

I did try using a placeholder in the index.tpl file:
{msgQuote}
and put the following in the language file:

Code: Select all

$PMF_LANG["msgQuote"] = "<?php include ('../ssi/quotes/rotate.php') ?>";
and in the index.php:

Code: Select all

$main_template_vars = array(
...
'msgQuote'          => $PMF_LANG['msgQuote'],
...
}
but all that I get is the raw php code in the rendered page.

Are there guidance notes somewhere - sorry if this is obvious, but I'm a PHP newbie.
Post Reply