Jump to content

[SOLVED] Passing a variable upward???


jwwceo

Recommended Posts

I have a question which Im sure has an easy answer..at least I am thinking it does..

 

IS it possible to pass a variable upward??

 

For example, if I have a page with a header template, a content section, and then a footer; how would I use a variable that's in a content page, in the header. My specific problem is that I want to use custom title pages for my site. But the header is always the same. So I was thinking I can just put a title variable ( $title ) in my content section for each page. But how would I pass this info into the header.

 

I realize I could also write if statements in the header, but how wold the header know which page is being used in the content?? Is there a function to grab the current URL? and then what if that URL is full of Get values??

 

Any tips would be awesome!!

 

James

Link to comment
Share on other sites

What you do is on the content page you create all of the variables you want the header to use.  Then include the header.  There's nothing saying you have to include the header before writing the rest of your code on the page.  Write your page-level variables first, then include the header, and that will allow you to use the page-level variables in the header.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.