Jump to content

Best Practice on How to Structure PHP/HTML Code?


limitphp

Recommended Posts

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

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.

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.

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.