View Full Version : How to insert a PHP include file?
Jim_Westergren
12-04-2005, 07:46 PM
Hi,
I am a PHP newbie.
I have a PHP file that makes a RSS feed and I want to include it in the template files.
I tried PHP include, SSI, wrapping it between {php}, {include file="rss.php"}, etc. but I cannot make it work.
Basically what I need is to be able to insert this in the template files:
<?php include("rss.php"); ?>
Thanks!
kickass
12-04-2005, 09:39 PM
This is what I use to include another file in a template set, so I don't see why it wouldn't call in a php file:
Content visible to registered users only.
And if you need it to just be called into a specific category or link page I think I've got a handle on that too . . .
phil2564
12-04-2005, 09:51 PM
This is the proper way to call php files into your main template or any template within:
{php}include("your-file-name-&path.php");{/php}
Add your site to my new directory
http://www.add-my-link.com/search/
Jim_Westergren
12-04-2005, 09:58 PM
Content visible to registered users only.
I just tried that, was something new.
What happens is that is shows the included file as html and prints all the PHP on the screen instead of running it as PHP.
Content visible to registered users only.
You have no category for directories, I have submitted my sites to the ones you have categories for.
gustotelmy
12-06-2005, 06:05 AM
thanks this helped me a BUNDLE!
Jim_Westergren
12-06-2005, 06:08 AM
Content visible to registered users only.
Did you get it to work?
I didn't ... :cry:
Somebody knows the solution?
gustotelmy
12-06-2005, 07:58 AM
Content visible to registered users only.
Did you get it to work?
I didn't ... :cry:
Somebody knows the solution?[/quote]
i can help you tomorrow cause its 3am here.... i can show you its real easy...i will make a simple to follow tutorial as i went through a long learning process to fix it perfectly... yeah im slow! :D :P
tip is to include most of your webpage as a php file except for the body...
i used the top part of my page and the bottom... then i simply added that as includes to the header.tpl and the footer.tpl in the templates folder
thats the simple solution... if you need more help ill be around tomorrow...
Jim_Westergren
12-08-2005, 01:20 AM
Hi gustotelmy,
thanks a lot but I think we talk about different things here :)
The problem that I am trying to solve is how I can get a php file with a script to get executed as PHP and the result displayed on a template file.
$5 paypal for the solution.
computergenius
12-08-2005, 06:23 AM
Jim, try this to get you started.
Create a file called temp.php, which contains
<?php echo "hello world" ?>
Put it in the root folder, with captcha.php, etc.
Amend templates/header.tpl, and just below the line
<body>
add the line:
{php}include("temp.php");{/php}
This puts hello world at the top of the screen, and establishes the principal of how to add php files.
... I think! (new to phplinkdirectory AND Smarty, but not new to PHP!)
I, Brian
12-14-2005, 10:55 AM
Thanks for the tip, computergenius - but I still can't get it to work.
It's really important for me to be able to call includes from my ad server - at the moment I can't call up anything.
vBulletin® v3.8.0, Copyright ©2000-2012, Jelsoft Enterprises Ltd.