FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Include php file
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Include php file [message #161782] Fri, 05 February 2010 19:17 Go to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
How do I include a php file in the header?

For example, I have navbar.php that I want included on the forums (domain.com/forums) so it displays the same information as the homepage (domain.com) and I will only have to edit the navbar.php to edit both the homepage and forums.

Is this possible? I have tried creating a tmpl for it, but it does not work. And yes, I have rebuilt the forum several times..

[Updated on: Fri, 05 February 2010 21:01]

Report message to a moderator

Re: Include php file [message #161783 is a reply to message #161782] Fri, 05 February 2010 21:29 Go to previous messageGo to next message
btweedy is currently offline  btweedy   United States
Messages: 10
Registered: January 2010
Location: Charleston, SC
Karma: 0
Junior Member
To clarify:

I have a php file (navbar.php) that I am including on my home page (domain.com/index.php).

I want to be able to include this in the forum's header (header.tmpl) so when domain.com/forum (and all pages in the forum) will display this same navbar.php.

The problem I am having is in the header.tmpl, the nav bar is displaying where I have the {REF: navbar.tmpl} statement instead of where I have the {TEMPLATE: navbar}

Right now I have navbar.inc.t in the src folder that provides the include statement.

I then have navbar.tmpl file in the tmpl for the respected forum that takes this .inc.t file. Inside this tmpl file I have the following:

{MAIN_SECTION: navbar}
{VAR: nav}
{MAIN_SECTION: END}

The nav variable is defined in the navbar.inc.t and is set to the include statement.

Now, when I put the {REF: navbar.tmpl} statement in the header.tmpl, it displays the navbar instead of where the {TEMPLATE: navbar} statement is.
Re: Include php file [message #161785 is a reply to message #161783] Sat, 06 February 2010 06:24 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Sounds complicated. To put includes into the header should be as simple as <?php your code ?>.

Maybe <?php include 'navbar.php'; ?> ?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Synch of newsgroup posts with web forum ?
Next Topic: Parsing a subject in a PM url
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 01:03:23 GMT 2024

Total time taken to generate the page: 0.02360 seconds