PHP includes in tem...
 
Notifications
Clear all

PHP includes in template.php

7 Posts
4 Users
0 Reactions
1,785 Views
(@soundspretty)
Posts: 65
Trusted Member
Topic starter
 

Does anyone know of a way to use PHP includes in the template.php (not the skin templates, but an actual page of the site like index.php, stories.php, etc.) to make the content show up between the header and footer?

I'm wanting to incorporate a blog script to use on my site, and link the content through a php include so that it will share the same layout as my skins. Since it's a php script I can't create a custom page through the admin panel, because that's for text and HTML (to my knowledge at least). To do this, I copied template.php as blog.php and want to create a page that way. The only problem is I can't figure out where or how to place the php include code onto the page.

Is this possible? And if so, any ideas?


 
Posted : 29/06/2007 10:57 am
(@jacci)
Posts: 503
Honorable Member
 

have you tried adding

require('path/script.pph');

into the part where you want it?

since the template is php already and not a tpl, that might work


why is nothing ever easy?
url: http://www.pretendercentre.com/missingpieces/     
php: 5.2.5  msql: 5.0.45-community
efic version: 3.4.3           latest patches: yes
bridges: none              mods: challenges, displayword, beta-search

 
Posted : 29/06/2007 11:20 am
(@tammy)
Posts: 2577
Member Moderator
 

Actually if you've updated to 3.3 you can now use php in your custom pages.


<?php
include("PATHTOFILE/include.php");
?>

Make sure you turn tinyMCE off before you enter your code.  It tends to do wierd things to code.  You can just use the checkbox to turn it off in that field.


 
Posted : 29/06/2007 12:34 pm
(@soundspretty)
Posts: 65
Trusted Member
Topic starter
 

I'm having trouble getting the content to display between the header and footer. I thought it was a template problem with the blog script, but I tried a test page and it's doing the same thing. Links:

http://www.gcfanfics.com/viewpage.php?page=blog
http://www.gcfanfics.com/viewpage.php?page=test


 
Posted : 29/06/2007 3:35 pm
(@tammy)
Posts: 2577
Member Moderator
 

You probably aren't going to be able to get a pre-made script to work with eFiction.  You need to feed the blog script into the $output variable.  And then assign $output to $tpl.  Most pre-built scripts are going to use echo. 


 
Posted : 29/06/2007 6:10 pm
(@chris)
Posts: 77
Trusted Member
 

I think I understand a little but could you explain in more detail? Because I think this is the problem I am having right now.


I charge into the light and need only yours to find my way. Archive of One: Sam Emme Tales

 
Posted : 07/09/2007 8:27 pm
(@tammy)
Posts: 2577
Member Moderator
 

Your script is probably using the "echo" or "print" command to print the results of the script right to the screen.  eFiction needs to go through the template so it can put the header, footer, etc in the correct place.  In the custom pages this is done by sending it to the $output  variable.

Replace:


echo "do something";

with:


$output .= "do something";

in the script.


 
Posted : 13/09/2007 10:03 am
Share: