简体   繁体   English

如何将现有的Joomla模板修改为Joomla 3.x模板?

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

I am a beginner in Joomla! 我是Joomla的初学者! I have to upgrade a Joomla 2.5.x version site to the latest version of Joomla. 我必须将Joomla 2.5.x版本站点升级到最新版本的Joomla。 I've checked the compatibility of all the existing components/modules/plugins of version 2.5.19 and they are all compatible in Joomla 3.x. 我已经检查了2.5.19版中所有现有组件/模块/插件的兼容性,并且它们在Joomla 3.x中都兼容。 The only problem is the template. 唯一的问题是模板。 I just don't know how to procceed and where to start from to modify it. 我只是不知道如何进行以及从何处进行修改。

This are some of the lines of my templateDetails.xml : 这是我的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>

And this are some of the lines of my index.php file : 这是我的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>
...
...
...

Any suggestions are welcomed! 任何建议都欢迎!

Ok having looked at your code, here are a few things. 好了,看完您的代码,这里有几件事。

Firstly, you XML file is fine and doesn't require any changing. 首先,您的XML文件很好,不需要任何更改。

To import jQuery in noConflict mode and ensure it is only done once, you should replace this: 要以noConflict模式导入jQuery并确保仅完成一次,则应替换为:

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

with this: 有了这个:

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

Once done, you can remove this code: jQuery.noConflict(); 完成后,您可以删除以下代码: jQuery.noConflict();

To get values from the configuration.php file, don't use $app->getCfg() as it's deprecated. 要从configuration.php文件获取值,请不要使用$app->getCfg()因为它已被弃用。 Instead use, $app->get() . 而是使用$app->get() So in your case, replace this: 因此,在您的情况下,请替换为:

$app->getCfg('live_site')

with this 有了这个

$app->get('live_site');

Other than that, I don't see any other issues with the code. 除此之外,代码没有其他问题。

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

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