Jump to content

[SOLVED] variables outside of functions


garry

Recommended Posts

So I have a function to add the header to my site called add_header. This will add a file called header.php to the document

 

I have a menu in the header and I want to use an if ($variable == 'somepage') { change the id }

 

This would change the id of the menu so that the current page is a different color. The problem is, even if I add the $variable at the top of the page, it is not available within the function and I get an error.

 

Is there any way to fix this?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/107938-solved-variables-outside-of-functions/
Share on other sites

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.