Yii sets its own CSS style for JUI-PHP source code

Source: Internet
Author: User
Yii sets its own CSS style for JUI Yii sets its own CSS style for JUI

JUI in Yii is really powerful, but many times its own style is not in coordination with our website. For example, I made two skins, one in blue and the other in red, and the self-built JUI is indeed Gray.

Every Jui Widget in Yii inherits CJuiWidget. Therefore, Yii sets theme or themeUrl in each CJuiWidget. But the problem comes again:

If I set CJuiWidget: theme, once I change the topic, I need to modify all the places used in the program.

If I have set CJuiWidget: themeUrl, I cannot know the themeUrl after the topic is changed. even if CTheme is used to specify the current theme address, it cannot be guaranteed that the Jui style is also placed on the themes created by others.

Therefore, it is unreliable to specify the Jui css style in the program. Therefore, to ensure that the subject can be changed at any time, and the Jui part must have the same color as the subject, you can write it in the layout file of the topic as follows:

 

 Theme-> getBaseUrl ();?> /Css/jui/jquery-ui.css "/>

 The idea of this code section is that once the CJuiWidget class appears, it means that the current page uses a widget derived from CJuiWidget, we can introduce a css style of the current theme to overwrite the built-in style. In this way, it is the best solution I have come up with to determine whether to use a custom Jui style.

The preceding figure shows how Yii sets its own CSS style for JUI. For more information, see PHP Chinese website (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.