2015-01-14 74 views
0

我已經創建了一個在Joomla中使用的組件,它似乎有與我的自定義主題一起工作的問題。首頁完美地工作,但當進入組件視圖時,它似乎將應該在頭部的內容移動到主體標籤。我已經嘗試過這個默認的主題,它似乎工作,所以我很有信心,這是我的個人主題的問題。Joomla組件渲染視圖<head>至<body>

<?php 

defined('_JEXEC') or die('Restricted access'); 

JHtml::_('jquery.framework'); 
$doc = JFactory::getDocument(); 

$doc->addStyleSheet('templates/' . $this->template . '/css/bootstrap.css'); 
$doc->addStyleSheet('templates/' . $this->template . '/css/style.css'); 
$doc->addScript('templates/' . $this->template . '/js/bootstrap.js', 'text/javascript'); 
$doc->addScriptDeclaration ("   jQuery('.carousel').carousel({ 
      pause: 'false' 
     });"); 
?> 

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" > 
<head> 
    <jdoc:include type="head" /> 
</head> 
<body> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div id="backspinner"> 
       <div id="back-carousel" class="carousel slide carousel-fade" data-ride="carousel"> 
        <div class="carousel-controls"> 
         <!-- Indicators --> 
         <ol class="carousel-indicators"> 
          <li data-target="#back-carousel" data-slide-to="0" class="active"></li> 
          <li data-target="#back-carousel" data-slide-to="1"></li> 
         </ol> 
        </div> 

        <!-- Wrapper for slides --> 
        <div class="carousel-inner"> 
         <div class="item active"> 
          <img src="/templates/sheffieldford/images/back1.jpg" class="backimage"> 
          <div class="carousel-caption"> 
          ... 
          </div> 
         </div> 
         <div class="item"> 
          <img src="/templates/sheffieldford/images/back2.jpg" class="backimage"> 
          <div class="carousel-caption"> 

          </div> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
     <div class="row"> 
      <div class="col-md-2" id="headleft"></div> 
      <div class="col-md-8" id="head"> 
       <div class="boundingbox"> 
        <div class="row"> 
         <div class="col-md-2 col-md-offset-1"> 
          <img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/fordlogo.png" id="logo" class="fordlogo"> 
         </div> 
         <div class="col-md-2 col-md-offset-2"> 
          <a href="/"><img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/logo.png" alt="Logo" id="logo"/></a> 
         </div> 
         <div class="col-md-3 col-md-offset-2" id="callbox"> 
          <div id="callboxtext"> 
           <?php 
            $article = JControllerLegacy::getInstance('Content')->getModel('Article')->getItem(2); 
            echo $article->introtext; 
           ?> 
          </div> 
         </div> 
        </div> 
       </div> 
       <div class="row"> 
        <div class="centered-pills"> 
         <jdoc:include type="modules" name="navigation" /> 
        </div> 
       </div> 
      </div> 
      <div class="col-md-2" id="headright"></div> 
     </div> 
     <div class="row"> 
      <div class="col-md-8 col-md-offset-2"> 
       <div class="boundingbox"> 
       <jdoc:include type="component" /> 
       </div> 
      </div> 
     </div> 
     <div class="row footerrow" id="footer"> 
      <div class="col-md-8 col-md-offset-2 col-xs-10 col-xs-offset-1"> 
       <div class="boundingbox"> 
        <div class="row" style="margin:0px;"> 
         <div class="col-md-6"> 
          <div class="row"> 
           <div class="col-md-4 footercolumn"> 
           <h3>Accident Repairs</h3> 
            <ul> 
             <li>Ford Accident Management</li> 
             <li>Accident Repairs</li> 
             <li>Smart Repairs</li> 
             <li>Dentals Paint Removal</li> 
            </ul> 
           </div> 
           <div class="col-md-4 col-md-offset-2 footercolumn"> 
           <h3>Vehicle Servicing</h3> 
            <ul> 
             <li>Ford Blue Service</li> 
             <li>Service Plans</li> 
             <li>Ford Warranty</li> 
             <li>Special</li> 
            </ul> 
           </div> 
          </div> 
          <div class="row footerrow hidden-xs hidden-sm"> 
          <div class="col-md-4 footercolumn" > 
           <img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/footerlogo.png" class="infoimage footerlogo"/> 
          </div> 
          <div class="col-md-4 footercolumn" > 
           <img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/motalogo.png" class="infoimage footerlogo" style="margin-top: 11px;"/> 
          </div> 
          <div class="col-md-4 footercolumn" style="margin-top: 6px;"> 
           <div class="footerimg"> 
            <a href="https://www.facebook.com/clarkandpartners" target="_blank"><img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/facebook.png" style="display: block; 
              float: left;"/></a> 
            <span class="spacer"></span> 
            <a href="https://twitter.com/clark_partners" target="_blank"><img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/twitter.png" style="display: block; 
              float: left;"/></a> 
           </div> 
          </div> 
         </div> 
         </div> 
         <div class="col-md-6"> 
          <div class="col-md-4 col-md-offset-2" id="contactdetails"> 
           <a href="#">Special Offers</a></br> 
           <a href="#">Ford Warranty</a></br> 
           <a href="#">About Us</a></br> 
           <a href="#">Customer Reviews</a></br> 
           <a href="#">Adaptations</a></br> 
           <a href="#">News</a></br> 
           <a href="#">Contact Us</a></br> 
          </div> 
          <div class="col-md-6" id="contactdetails"> 
          <?php $article = JControllerLegacy::getInstance('Content')->getModel('Article')->getItem(3); 
           echo $article->introtext;?> 
          </div> 
         </div> 
         <div class="row footerrow hidden-md hidden-lg"> 
          <div class="row"> 
           <div class="col-xs-6 col-xs-offset-3 footerimgxs"> 
            <a href="https://www.facebook.com/clarkandpartners" target="_blank"><img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/facebook.png"/></a> 
            <a href="https://twitter.com/clark_partners" target="_blank"><img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/twitter.png"/></a> 
           </div> 
          </div> 
          <div class="row"> 
           <div class="col-xs-8 col-xs-offset-2 footercolumn" > 
            <div class="row footerimgxslogo"> 
             <img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/footerlogo.png"/> 
            </div> 
            <div class="row footerimgxslogo"> 
             <img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template;?>/images/motalogo.png"/> 
            </div> 
           </div> 
          </div> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</body> 

我已經準備好,其他人有固定的問題與改變編碼UTF8與BOM但是這似乎並沒有改變任何東西爲我。

+0

爲了查明此,我已發現,當跑被更改爲<包括類型= 「頭」 jdoc>。任何想法爲什麼會這樣做? –

回答

0

假設這是您的自定義模板index.php文件,問題在於您如何將網站組件添加到您的模板中。當您使用Joomla的語句時,您正手動實例化並呈現組件視圖。

交換驗證碼出來:

<?php $article = JControllerLegacy::getInstance('Content')->getModel('Article')->getItem(3); 
      echo $article->introtext;?> 

爲:

<jdoc:include type="component" /> 

你組件應正確顯示。事實上,有很多Joomla集成問題只會進一步阻止管理員儀表板對您的內容進行適當的管理。菜單,登錄,警報和調試等部分均使用模塊進行分配。

如果你還沒有簽出一個核心模板的index.php,我會給它一個評論。還附加了關於創建Joomla模板的文檔鏈接。

祝你好運!

https://docs.joomla.org/Portal:Template_Development