duanben4771 2014-04-11 08:37
浏览 114
已采纳

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

I am a beginner in Joomla! I have to upgrade a Joomla 2.5.x version site to the latest version of 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. 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:

<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 :

<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!

  • 写回答

1条回答 默认 最新

  • donglin6109 2014-04-11 09:08
    关注

    Ok having looked at your code, here are a few things.

    Firstly, you XML file is fine and doesn't require any changing.

    To import jQuery in noConflict mode and ensure it is only done once, you should replace this:

    <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();

    To get values from the configuration.php file, don't use $app->getCfg() as it's deprecated. Instead use, $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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题