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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.