PDA

View Full Version : Can I include files in the template?


echopulse
12-10-2005, 08:02 PM
I'm trying to include a file in the template, it will not work. Anyone know how to do this? I put this in the tpl file, and it doesn't work.

<?
include("dynamicpoll/poll.php");
?>

gb
12-10-2005, 08:12 PM
hi echopulse,

to include php files you can use a built in fuction af smarty:

{include_php file="/path/to/load_nav.php"}

I'm refering to smarty manual:

http://smarty.php.net/manual/en/language.function.include.php.php

greetings,
gb

echopulse
12-10-2005, 08:13 PM
I just read in another thread, that smarty has it's own way of including php files. So I read the manual, and it says to use this:

{include_php file="/path/to/load_nav.php"}

I tried that, and I get some errors.

Open http://www.conservativeportal.com to see what I mean.

echopulse
12-10-2005, 08:14 PM
You beat me to it. I used the complete path, and it is reading the file now. But apparantly there are some directories it can't access.

gb
12-10-2005, 08:26 PM
I would need to see the poll.php to help. Maybe you need to refer on line 111 (where the warning is generated) also with the full path now to the directory /polldata

Give it a try... (see my signature ;-))

greetings,
gb

echopulse
12-11-2005, 10:07 PM
You were correct. Adding the full path to that file fixed the error. There were other errors, so I switched to Fpoll. It works really well, and is simple. Threre are no archives, but all I have to do is take a screen capture, and add it to my archive page. So it works out great.

Vasily B.
12-13-2005, 07:20 AM
I tool a look and I could see you have a poll on your site ;) quite cool modification.. I think we should create it in our default version