jwwceo Posted December 21, 2007 Share Posted December 21, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/82755-solved-passing-a-variable-upward/ Share on other sites More sharing options...
papaface Posted December 21, 2007 Share Posted December 21, 2007 Not possible. Quote Link to comment https://forums.phpfreaks.com/topic/82755-solved-passing-a-variable-upward/#findComment-420896 Share on other sites More sharing options...
p2grace Posted December 22, 2007 Share Posted December 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/82755-solved-passing-a-variable-upward/#findComment-420920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.