【问题标题】:What if I don't use standard joomla CSSs in my custom templates?如果我不在我的自定义模板中使用标准的 joomla CSS 怎么办?
【发布时间】:2012-11-04 15:20:54
【问题描述】:

我想知道我应该使用这些代码行来包含标准 Joomla CSS 规则吗?

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />

我们知道,在这些行之后,我们当然会使用我们自己的模板特定 CSS 文件来覆盖一些规则,如下所示:

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/template.css" type="text/css" />

重要提示:假设我不想为每个人发布模板,我只会在我的特殊需要时使用它。 所以我会在需要的地方定义必要的规则。

有了这个假设,我还应该包含前两个 CSS 吗?为什么?

【问题讨论】:

    标签: css joomla template-engine templating


    【解决方案1】:

    如果您不需要样式,则没有理由包含样式表。可能发生的最糟糕的情况是您会看到一些损坏的格式,您必须在自己的 css 中修复它。

    【讨论】:

      【解决方案2】:

      要为你的模板添加一个css文件,你可以将你提供的代码添加到模板文件夹中的index.php中,也可以使用Joomla的方法嵌入一个css文件,如下所示:

      $doc = JFactory::getDocument();
      $doc->addStyleSheet($this->baseurl.'/templates/yourtemplate/css/system.css');
      $doc->addStyleSheet($this->baseurl.'/templates/yourtemplate/css/general.css');
      

      【讨论】:

        猜你喜欢
        • 2019-06-03
        • 1970-01-01
        • 1970-01-01
        • 2020-09-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-01
        • 2023-03-09
        相关资源
        最近更新 更多