问题描述
我即将开始创建一个中等规模的Web项目,这个项目非常重要。
依赖于数据库交互。
因为大多数页面都包含重复出现的形式元素(输入文本
框,下拉框,单选按钮,提交表单,表格等),我想b / b
想用块来向每个页面插入组件。所有
标准元素都是表单元素类的实例。调用
这些对象将生成自定义的HTML代码。
例如:cbo框可以通过以下方式在脚本中实例化:
< p>选择客户:< / p><?php creatElement($ cboName,$ cboCSS,$ cboVal,
$ cboOpt,..); ?>
这样的方法是否会比传统的
逐行方法更有效率。调试,维护等? (我真的
恐惧混合php和html。)。虽然我喜欢Smarty的模板方法,但是看起来Smarty仍然需要线性编码来进行代码翻译。
我根据网格可视化html页面可以通过html块组件填充单元格
。这种做法有点过于花哨吗?
感谢您的任何见解,
Mark
I am about to embark on creating a mid-size web project that heavily
relies on db interactions.
Since most pages will contain recurring form elements (input text
boxes, dropdown boxes, radio buttons, submit forms, tables, etc.), I am
thinking of using blocks to insert components to each page. All
standard elements would be instances of form element classes. Calling
up these objects would generate customized html code.
Ex: a cbo box could be instantiated in a script via:
<p>Select Customer:</p><?php creatElement($cboName, $cboCSS, $cboVal,
$cboOpt, ..); ?>
Would such an approach be more efficient that the traditional
line-by-line approach wrt. debugging, maintenance, etc. ? (I really
dread mixing php and html.). While I like Smarty''s templating approach,
it seems Smarty still requires linear coding to do code translation.
I visualize html pages in terms of grids where cells could be filled up
by html block components. Is this approach somewhat too fancy?
Thanks for any insights,
Mark
推荐答案
这篇关于设计方法论问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!