【问题标题】:joomla 1.5 Custom mobile framework not loading cssjoomla 1.5自定义移动框架不加载css
【发布时间】:2014-08-21 05:01:27
【问题描述】:

嗨,伙计们,我的任务是将自定义框架从 joomla 1.5 迁移到 3.0 我已经获得了可以完美加载主页的框架,但是当我转到其他页面时,这里的 css 不会加载是代码:

PHP:

<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" />

<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/addons.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/layout.css" type="text/css" />

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

<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/typo.css" type="text/css" />

HTML 输出:

<link rel="stylesheet" href="http://flyvail/index.php/templates/system/css/system.css" type="text/css" />

<link rel="stylesheet" href="http://flyvail/index.php/templates/system/css/general.css" type="text/css" />

<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/addons.css" type="text/css" />

<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/layout.css" type="text/css" />

<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/template.css" type="text/css" />

<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/typo.css" type="text/css" />



<!-- CSS for handheld devices -->

<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/handheld/layout.css" type="text/css" />

<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/handheld/template.css" type="text/css" />


<!-- CSS for handheld devices -->

<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/handheld/layout.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/handheld/template.css" type="text/css" />

<!-- //CSS for handheld devices -->

我不知道为什么加载不正确

【问题讨论】:

    标签: php html css joomla migration


    【解决方案1】:

    假设这是在您模板的 index.php 文件中,然后尝试:

    $doc = JFactory::getDocument();
    $doc->addStyleSheet($this->baseurl.'/templates/'.$this->template . '/css/NAMEOFSTYLESHEET.css', $type = 'text/css', $media = 'screen,projection');
    

    改为添加样式表。

    我的猜测是$this-&gt;baseurl() 不适用于(),因为它是一个参数,而不是一个函数。因此,您的链接显示时没有 baseurl 是由相对链接生成的,该链接还考虑了 joomla 设置的基本 href。这意味着当您不在站点的根目录中时,链接是错误的。

    (如果您只是删除所有 (),您的代码可能会工作,但 addStyleSheet 方法更好)

    如果这不起作用,您能否查看生成的 URL 在您说它有效的主页和您说它不有效的子页面上是否不同,并将此附加信息添加到您的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-23
      • 2013-10-30
      • 2018-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-06
      相关资源
      最近更新 更多