Jump to content
MakeWebGames

Best Way To Code Layout View


Kaien

Recommended Posts

I have progressed with php over the time as I used to use mccodes but not anymore, as I see no use for it anymore. My knowledge of php is fairly good. I am currently looking at AJAX to improve my work with looks and compatibility.

My question is, what is the best way to code a layout?

Currently, I only know of three ways to do this but If there any other ways could you please specify them here.

The first way is through templates using an already made template engine. The second, is through switches, and placing it all on the index.php file. The third and last way I know is to split up the layout in different parts and code along placing them at the top and bottom of the script. I'm looking for another way to possibly code the layout view like how mccodes does it but without having to add ./?id=1 or ./?page=home at the end.

Link to comment
Share on other sites

Use an already used template engine. Smarty seems to be my favorite, but I've never tried out any others. You then can create library templates for like the header, footer and navigation menu. You can then make sort of an information box that you can dynamically change the contents of with either GET parameters or some other method for page moving.

Link to comment
Share on other sites

Its just better for web development to not mix PHP and HTML. Most of all these game engines mix it to no end, but true new web development follows the Model-View-Controller. However, the MVC model is kinda for the PHP side of things, so it doesn't truly apply to templates. Trust me that if you start working with a team or another developer needs to work on your code. Its 1000x easier to modify templates & their associated PHP files then messing around with a massive PHP file that mixes 10 different languages.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...