Jump to content

Pass a variable to a required page???


newnewbie

Recommended Posts

I have a page in which i require another page. For instance I want a variable (the page title) in 'main.php' to pass to the required page (template).  The reqired page contains my header, nav, footer, etc. 

 

So, in main.php i have:

 

<?php

require_once("template.php");

?>

 

<?php

$page_title = 'Home';

?>

 

In the header section of template.php, I want to use the variable $page_title to print as Home.

Something like <title>print $page_title</title>

 

This can't be that difficult, but check out my ID...newnewbie!

 

Thankx in advance as always!

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/198000-pass-a-variable-to-a-required-page/
Share on other sites

All that time and all I had to do was put the variables before the require code.  This worked and actually solved two of my problems  I have been teaching myself php for a couple of weeks...sooo much to learn.  Thank you for helping my day be much brighter!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.