Kaien Posted September 12, 2011 Share Posted September 12, 2011 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. Quote Link to comment Share on other sites More sharing options...
Neon Posted September 13, 2011 Share Posted September 13, 2011 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. Quote Link to comment Share on other sites More sharing options...
Kaien Posted September 13, 2011 Author Share Posted September 13, 2011 Smarty eh? I dislike using templates but ill try it out anyway. Thank you for your reply. Quote Link to comment Share on other sites More sharing options...
Neon Posted September 13, 2011 Share Posted September 13, 2011 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. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted September 13, 2011 Share Posted September 13, 2011 Smarty sucks, just use a function not a switch on the index page, McCodes does it the n00b way. 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.