duanli9001 2011-06-30 09:38
浏览 107
已采纳

为什么在yii框架中使用Chtml

Considering that Chtml means extra processing for server side to convert from php to html, so it impacts performance, how much will the impact be considering a high usage application. Alternatively if we use plain html, is it the better way to go.

  • 写回答

1条回答 默认 最新

  • dougan6982 2011-06-30 13:33
    关注

    It's easier to maintain. For instance, a drop down box. Say you wanted to change the values. With Chtml it can pull the values from a database which means you could make an "administrative" view for said form. I make these "administrative" views for my applications so a tech can change the form without asking me to change code. If it was html, I'd have to change my hard coded values by hand for something that I shouldn't really be dealing with.

    Also, the more complex views you make the more chtml makes sense. For instance, I use CactiveForm which interacts with my Active Record models. It makes validation easier for me to maintain and code in the first place. A tutorial on CActiveForm can be found here.

    The performance shouldn't be an issue. The php isn't doing anything fancy. If you turn on debugging in your main index.php file you can actually see how long things take. My views compute in .002 of a second. :)

    Good question by the way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 pb数据库修改或者求完整pb库存系统,需为pb自带数据库
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路