为什么是小部件而不是 HTML? [英] Why Widgets and not HTML?

查看:33
本文介绍了为什么是小部件而不是 HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Yii 框架的开发过程中注意到有
许多基本 HTML 元素的函数(CHtml 有按钮、链接等)以及菜单(可以很容易地用列表替换).我的问题是在任何地方都可以使用小部件被认为是理想的选择吗?我什么时候应该使用 HTML ?

I've noticed in my development with the Yii framework that there's
a function for many basic HTML elements (CHtml has button, link, etc.) as well as for a menu (that could easily be replaced with a list). My question is it considered ideal to use widgets wherever I can ? When should I use HTML ?

推荐答案

有时,框架会用自己的小部件替换基本 HTML.

Sometimes, frameworks replace basic HTML with their own widgets.

在链接小部件的情况下,框架可能会做一些额外的事情,比如如果链接指向当前页面,它会自动提供 class="active",这样它就可以有不同的样式.

In the case of a link widget, the framework might do additional stuff like automatically giving it class="active" if the link is to the current page, so it can be styled differently.

这篇关于为什么是小部件而不是 HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆