繁体   English   中英

joomla 1.5自定义移动框架未加载CSS

[英]joomla 1.5 Custom mobile framework not loading css

嗨,大家好,我的任务是将自定义框架从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 -->

我不确定为什么加载不正确

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

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

而是添加样式表。

我的猜测是$this->baseurl()不能与()一起使用,因为它是参数而不是函数。 因此,显示的链接没有baseurl是由相对链接生成的,该链接也考虑了joomla设置的base href。 这意味着当您不在站点的根目录中时,该链接是错误的。

(如果您只删除了所有(),则您的代码可能会起作用,但是addStyleSheet方法更适用)

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM