作者:郭楠v | 来源:互联网 | 2023-06-04 12:00
IamcreatinganadminpanelfromscratchandIwouldliketoknowwhattechniquesthereareforme
I am creating an admin panel from scratch and I would like to know what techniques there are for me to utilize in order to minimize the need for duplicate code (especially for HTML).
我正在从头开始创建一个管理面板,我想知道有哪些技术可供我使用,以最大限度地减少重复代码的需求(特别是对于HTML)。
A way back I just re-wrote all of HTML in every single file. While this gave the ultimate modifiability for single pages the amount of work and maintenance makes it the worst way to go.
回过头来,我只是在每个文件中重写了所有HTML。虽然这为单页提供了最终的可修改性,但工作和维护的数量使其成为最糟糕的方式。
Many years ago I started doing incorporating PHP into the HTML via functions like:
许多年前,我开始通过以下功能将PHP合并到HTML中:
PrintMenu();
PrintHeader();
PrintLeftBox();
While this shortened the need for code it made future alterations of the page too complex. What if I wanted to change the whole layout and remove left box from the HTML? Now I have hundreds of pages full of PrintLeftBox();
虽然这缩短了对代码的需求,但它使得页面的未来变更过于复杂。如果我想更改整个布局并从HTML中删除左框怎么办?现在我有数百页的PrintLeftBox();
These two simple ways are pretty much only ways I have ever created a website layout.
这两种简单的方法几乎只是我创建网站布局的方式。
Now I'm looking for a much more dynamic and efficient way to product a layout that can be modified per page and be redone easily.
现在我正在寻找一种更加动态和有效的方式来生成可以按页面修改并轻松重做的布局。
Most of my pages will look the same; menu on the top, huge content on the middle and a footer on the bottom. While some of the sites will require different kind of setup; a menu on the top, some sort of navigation on the left, a list of items on the middle and possibly an "edit view" on the right.
我的大部分页面看起来都一样;顶部的菜单,中间的巨大内容和底部的页脚。有些网站需要不同类型的设置;顶部的菜单,左侧的某种导航,中间的项目列表以及右侧的“编辑视图”。
How can I create a "layout system" that can work with pages that look different?
如何创建一个可以处理看起来不同的页面的“布局系统”?
I don't need any code, I need someone to point me in the right direction.
我不需要任何代码,我需要有人指出我正确的方向。
2 个解决方案