Website Structure

后端 未结 9 703
无人及你
无人及你 2021-02-04 19:43

I\'m pretty new to php and i\'m trying to decide the best way to organize the pages and, using PHP, deliver them. The two (basic) ideas I\'ve had are:

  • A bunch o

9条回答
  •  攒了一身酷
    2021-02-04 20:05

    Having used with both techniques in the past, I've found the former is more flexible, but that it can encourage poor practices. The latter provides a much more consistent user experience, as it keeps all your site-wide logic in one place and discourages you from making one-off exceptions.

    I'm actually in the process of converting a site I wrote a couple of years ago from the included header/footer/menu model to the master-page model. The original system of includes was clean and straightforward and works very well. However, the more additional content I created, the more I realized the project was beginning to violate the DRY principle. Every page on the site began and ended the same way (repetition should always send up warning signals) and I was being tempted to make exceptions to the standard layout by omitting individual includes and writing one-off replacements. (Thankfully, I haven't yielded to that temptation often!)

    Refactoring the site is making the pages more consistent, the layout easier to update (you can see the entire thing "at a glance"), and new pages easier to create.

提交回复
热议问题