limitphp Posted March 12, 2009 Share Posted March 12, 2009 I'm building a website that has many pages and is pretty complex. Alot of pages use many variables. Alot of pages use some of the same variables. Alot of pages use the same include php pages that handle things like the menu. Is there a best practice as far as structuring a php page? Like having all the variables the php page will use listed somewhere, or having it organized a certain way? Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 12, 2009 Share Posted March 12, 2009 There is no ONE best practice. Don't know exactly what you mean by some pages need the same variables. Are these "satic" in that they are the exact same values for each and every user (in that case use a config file that is included on all pages) or are these values static for each session/user (in that case use $SESSION). It all depends on the implementation. Quote Link to comment Share on other sites More sharing options...
limitphp Posted March 12, 2009 Author Share Posted March 12, 2009 There is no ONE best practice. Don't know exactly what you mean by some pages need the same variables. Are these "satic" in that they are the exact same values for each and every user (in that case use a config file that is included on all pages) or are these values static for each session/user (in that case use $SESSION). It all depends on the implementation. They are static for each session. Yeah, right now, I do use session variables. Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 12, 2009 Share Posted March 12, 2009 Oh, and if they would need to stay persistent for a user from session to sessin then, of course, you would use cookies. And, if you need to "save" any of these values you would want to use a database. Quote Link to comment 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.