The scenario:

场景:

  • A homepage that is generated with PHP and a template engine.
  • 用PHP和模板引擎生成的主页。
  • The page is being redesigned.
  • 页面正在重新设计。
  • The new design is based on jQuery UI.
  • 新的设计基于jQuery UI。
  • The current CMS uses multiple templates: a page template, an article details template, a comments template etc.
  • 当前的CMS使用多个模板:页面模板、文章细节模板、评论模板等。

The problem: Some templates (like the article details template) generate html fragments that should use jQuery UI elements like tabs. Currently the data source of the page template does not contain any information which elements should be turned into jQuery UI elements in the main jQuery call in the documents head.

问题是:一些模板(如文章细节模板)生成的html片段应该使用jQuery UI元素(如选项卡)。目前,页面模板的数据源不包含任何信息,在文档头部的jQuery主调用中,哪些元素应该转换为jQuery UI元素。

Possible solution Add a CSS class like "jqTabs" to the html markup of the sub-templates and use the selector .jqTabs in the main jQuery script.

可能的解决方案是在子模板的html标记中添加一个像“jqTabs”这样的CSS类,并在主jQuery脚本中使用selector .jqTabs。

Question Is this a bad idea?

问题是这是个坏主意吗?

BTW: "Use a different CMS" is not a valid answer, because this is not an option right now (deadline, budget,... you name it -.- ).

顺便说一句:“使用不同的CMS”不是一个有效的答案,因为这不是现在的选择(截止日期,预算,……)——你的名字。-)。

2 个解决方案

#1


3

Not a bad idea at all.

这主意不错。

That is one of the primary uses of classes.

这是类的主要用途之一。

A class (like and ID) can be used as both a way to style an element and / or a hook for scripting.

类(like和ID)可以用作样式化元素和/或脚本挂钩的方式。

In this case, it might be the best possible solution, as it allows for what seems to be minimal markup changes for a wider redesign.

在这种情况下,它可能是最好的解决方案,因为它允许为更广泛的重新设计提供看似最小的标记更改。

And it is easily reversible.

它很容易可逆。

更多相关文章

  1. 在Django模板标记库中导入外部库时出错
  2. 使用Python写HTML 文件使用jinja2中的模板
  3. 从Python中的列表元素中删除URL
  4. python selenium-webdriver 定位frame中的元素 (十三)
  5. Django模型选择:使用元组的第一个元素
  6. python 按位置关系输出矩阵元素
  7. 使用python如何在列表列表中找到元素,而关键元素是内部列表的元素
  8. 对numpy数组的每n个元素求平均值
  9. django模板引擎有错误检查?

随机推荐

  1. MySQL 单表上亿,怎么优化分页查询?
  2. MySQL如何配置读写分离?
  3. 分库分表怎么配?
  4. 解答、收录了 8 道 MyBatis 的题目
  5. 又梳理了 23 道 MyBatis 的题
  6. 解上篇文章 MyBatis 第一题
  7. 再解 5 题!国庆之后续更,假期愉快!
  8. 什么样的 Java 对象会被当垃圾回收?
  9. Lock锁子类了解一下
  10. 读完《MyBatis技术内幕》,聊几句感触