簡體   English   中英

如何將現有的Joomla模板修改為Joomla 3.x模板?

[英]How to modify an existing Joomla template to Joomla 3.x template?

我是Joomla的初學者! 我必須將Joomla 2.5.x版本站點升級到最新版本的Joomla。 我已經檢查了2.5.19版中所有現有組件/模塊/插件的兼容性,並且它們在Joomla 3.x中都兼容。 唯一的問題是模板。 我只是不知道如何進行以及從何處進行修改。

這是我的templateDetails.xml的一些行:

<extension version="2.5" type="template" client="site">
    <name>Harpo</name>
    <version>1.0.0</version>
...
<files>
        <filename>index.php</filename>
        <folder>css/</folder>
        <folder>images/</folder>
        <filename>templateDetails.xml</filename>
        <filename>error.php</filename>
    </files>
    <images>
        <filename>template_thumbnail.png</filename>
    </images>
...
<positions>
        <position>newsflash</position>
        <position>hornav</position>
        <position>breadcrumbs</position>
        <position>banner</position>
        <position>left</position>
        <position>right</position>
        <position>top</position>
        <position>user1</position>
        <position>user2</position>
        <position>user3</position>
        <position>user4</position>
        <position>user5</position>
        <position>footer</position>
        <position>syndicate</position>
        <position>debug</position>
    </positions>

</extension>

這是我的index.php文件的某些行:

<head>
<link rel="shortcut icon" href="<?php echo $app->getCfg( 'live_site' ); ?>templates/<?php echo $this->template ?>/images/favicon.ico"/>
<meta http-equiv="Content-Type" content="text/html;" />
<link href="<?php echo $app->getCfg( 'live_site' ); ?>templates/<?php echo $this->template ?>/css/template_css.css" rel="stylesheet" type="text/css" media="all"/>
<!-- <link href="css/template_css.css" rel="stylesheet" type="text/css" media="all"/> -->
<jdoc:include type="head" />
<meta name="verify-v1" content="PynT0gVSXBh484xuIjQakd0YZS+sHAYmOK+CRTa1aJI=" />
<script type="text/javascript" src="<?php echo $app->getCfg( 'live_site' ); ?>templates/<?php echo $this->template ?>/flashobject.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-32944659-1']);
    _gaq.push(['_trackPageview']);

    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
     })();

    jQuery.noConflict();
...
...
...
<body>
<div class="out">
    <div class="main">
    <!--Toparea Start-->
        <div class="top">
          <div class="logo_space">
              <div class="boxlogin"><jdoc:include type="modules" name="user2" /></div>
          </div>
          <div class="header">
            <img src="<?php echo $app->getCfg( 'live_site' ); ?>templates/<?php echo $this->template ?>/images/img_header.jpg" alt="sfondo_header" align="top" style="float:left;"  />
            <div id="flash" style="float:right; width:550px; height:132px;"></div>
            <script type="text/javascript">
                var fo = new FlashObject("<?php 
                    $flashPath = $app->getCfg( 'live_site' )."templates/".$this->template."/flash/animazione.swf";
                    echo $flashPath; 
                ?>", "Menu", "550", "132", "8", "#FFFFFF", "transparent");
                fo.write("flash");
            </script>

            <!-- <img src="<?php echo $app->getCfg( 'live_site' ); ?>templates/<?php echo $this->template ?>/images/img_headerright.jpg" alt="sfondo_header" align="top" style="float:right;" width="550" height="132"  /> -->
            <!-- <div class="boxlogin"></div> -->
        </div>

        <div class="topmenu">
            <?php if ($this->countModules( "top" )) { ?>
                <jdoc:include type="modules" name="top" />
            <?php } ?>
        </div>
    </div>
...
...
...

任何建議都歡迎!

好了,看完您的代碼,這里有幾件事。

首先,您的XML文件很好,不需要任何更改。

要以noConflict模式導入jQuery並確保僅完成一次,則應替換為:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

有了這個:

JHtml::_('jquery.framework'); // this is PHP so wrap it in PHP tags

完成后,您可以刪除以下代碼: jQuery.noConflict();

要從configuration.php文件獲取值,請不要使用$app->getCfg()因為它已被棄用。 而是使用$app->get() 因此,在您的情況下,請替換為:

$app->getCfg('live_site')

有了這個

$app->get('live_site');

除此之外,代碼沒有其他問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM