【问题标题】:Joomla template background and header imageJoomla 模板背景和标题图像
【发布时间】:2023-03-14 10:05:02
【问题描述】:

我已经直接在 index.php 文件中更改了我的 Joomla 模板中的背景图像以及标题图像。 我更改了图像 src。 我的问题是,当我在平板电脑或手机上打开网站时,这两张图片丢失了,但在台式机上没有问题。 我已经完成了@media 查询的所有内容,但找不到问题。请我需要帮助!她用 index.php 的代码

<?php
/**
* Date         July  31, 2014
* Copyright    Copyright (C) 2014 10templates.com
* License  GPL
*/
defined( '_JEXEC' ) or die;

$app = JFactory::getApplication();
$doc = JFactory::getDocument();

$this->language = $doc->language;
$this->direction = $doc->direction;

JHtml::_('bootstrap.framework');

?>
<?php include_once("analyticstracking.php") ?>
<!DOCTYPE html>
html xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this-  >language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo     $this->template ?>/css/template.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=yes"/>
<meta name="HandheldFriendly" content="true"/>
<meta name="apple-mobile-web-apple-capable" content="true"/>
<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/menu.js"></script>
<!--script src="/media/jui/js/bootstrap.min.js" type="text/javascript">   </script>
 <script src="/media/jui/css/bootstrap.min.css" type="text/css"></script--> 

 </head>
 <body>
 <!--main container -->
 <div class="container-fluid"> 

 <!--Begin header-->
 <div class="header">
 <div class="header-inner">
 <jdoc:include type="modules" name="position-2" style="none" />
 <header class="jumbotron">
 <img src="http://localhost/joomla/images/utv_pics/utv_transparent.gif" style="max-width:90%">
 <!--Begin Navbar-->
 <?php if ($this->countModules('position-1')) : ?>
 <div class="nav2">
      <!--button type="button" class="navbar-toggle" data-toggle="collapse" data-target="nav2">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      </button>
    <a class="brand" href="index.php"><?php echo $sitename ?></a>
  <div class="collapse nav-collapse" id="nav2"-->
  <jdoc:include type="modules" name="position-1" style="none" />

  <!--End navbar-->
  <?php endif; ?>
  </header></div></div></div>

  <div class="container-fluid"> 
  <div class="clearfix">
  <div class="leftCont">
  </div>

  <div id="content" role="main">

  <?php if ($this->countModules('position-9')) : ?>
  <div class="banners">
    <jdoc:include type="modules" name="position-9" style="none" />
  </div>
  <?php endif; ?>

  <!-- Begin Content -->
  <div class="insider">

  <jdoc:include type="component" />
  <jdoc:include type="modules" name="position-3" style="none" />
  </div>
  <!-- End Content -->

  </div>

  <div class="rightCont">
  <div class="clearfix">
  </div></div></div></div>
  <div class="container-fluid">
  <footer class="clearfix">
  <section>
  <?php if ($this->countModules('position-4')) : ?>
  <jdoc:include type="modules" name="position-4" style="xhtml" />
  <?php endif; ?>
  </section>
  <section>
  <?php if ($this->countModules('position-5')) : ?>
  <jdoc:include type="modules" name="position-5" style="xhtml" />
  <?php endif; ?>
  </section>
  <section>
  <?php if ($this->countModules('position-6')) : ?>
  <jdoc:include type="modules" name="position-6" style="xhtml" />
  <?php endif; ?>

  </section>
  </footer>
 </div></div>

 </body>
 </html>

【问题讨论】:

  • 我有没有提到我很绝望?

标签: css image mobile background-image joomla3.0


【解决方案1】:

您已添加本地图片网址:

<img src="http://localhost/joomla/images/utv_pics/utv_transparent.gif" style="max-width:90%">

如您所见,该 URL 指向本地开发工作站 localhost。该地址不适用于其他设备。

您应该改用 baseurl 属性:

<img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/images/utv_pics/utv_transparent.gif" style="max-width:90%">

并确保您的图像 utv_transparent.gif 位于当前模板文件夹内的 images/utv_pics 文件夹中。

【讨论】:

  • 谢谢你这是有道理的,我在所有错误的地方寻找......我现在已经改变了这个,现在我得到一个禁止的代码:Forbidden 你没有访问/test/的权限此服务器上的模板/acropolis3free/css/.../images/utv_pics/Toyota_image.jpg。此外,在尝试使用 ErrorDocument 处理请求时遇到 403 Forbidden 错误。
  • 我想知道这是否与我的引导程序遇到的问题相同:加载资源失败:服务器响应状态为 404(未找到)
  • 403 问题可能是由于文件权限。确保文件夹和文件对运行您的 http 服务器的用户具有读取权限。引导问题也可能是错误的 URL。检查上面的代码。它指向站点根目录下的 /media/jui/css 文件夹。文件真的存在吗?
  • 我的所有网址都正常工作,我没有更多的 404 错误代码,但我仍然有一个引导响应的错误代码..我的网站似乎工作正常..我查看了根据我得到的 Inspect 错误中的 url GET 请求,ftp 文件夹和引导文件在那里......所以现在我不知道问题出在哪里。感谢您对那些 url 的帮助,我在我的 @media 代码中搜索了数周,认为这是一个移动问题,甚至没有意识到它只适用于我的本地主机......感觉很愚蠢!但是非常感谢!!
  • 您使用引导程序得到的错误代码是什么?这是您在开发者控制台中看到的吗?
【解决方案2】:

你有一个错误的图像位置,适用于本地主机,即只适用于你的 PC。

代替

&lt;img src="http://localhost/joomla/images/utv_pics/utv_transparent.gif" style="max-width:90%"&gt;

只需使用这个

&lt;img src="/images/utv_pics/utv_transparent.gif" style="max-width:90%"&gt;

【讨论】:

  • 谢谢!我让它在 Chrome 中工作...不能在 Firefox 和 bootstrap 中工作......如果你知道我的 url 链接在哪里错误以及我可以在哪里找到 ti 来纠正我将不胜感激!
  • 您是否清理了浏览器缓存以及 Joomla 缓存。我建议的更改将在您清理缓存时显示。
猜你喜欢
  • 2012-04-22
  • 1970-01-01
  • 2016-11-26
  • 2017-04-26
  • 1970-01-01
  • 2016-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多