现在的位置: 首页 > 综合 > 正文

joomla模板、模块关系 | joomla网站建设第二贴

2013年09月02日 ⁄ 综合 ⁄ 共 6370字 ⁄ 字号 评论关闭

本来打算每天写一篇的,但是工作太忙,已经一周有余的,我尽量努力的把前面内容补上。今后我将用目前再建的一个网站同步记录,以方便读者查看。

网址是是:3c之家|短租公寓,可以通过输入http://www.3c-home.com/?tp=1来查看网站上的模块位置。下面截图看一下,

注意,我用的浏览器是firefox,ie的用户可能显示会有点区别,但是位置是这样的,我们暂且不必去关心这个问题。屏幕太小,不能全部显示,我们一部分一部分来看,上面的数据都是一些模板的原始数据及自己加入的qq在线客服功能(这个还是比较有用的)。

一、左上角:logo位置,大家一般会在这里放入自己的logo,当然也可以放别的,它只是个位置。来看一下后台,

就是现在的logo模块位置。logo模块决定其模块内的内容,但具体在哪里显示及显示风格是由模板文件来决定的。

我们来到后台扩展》模板管理》模板》模板里面可以看到相应信息。

二、我们在文件模板文件夹里看一下

templates/bt_education/templateDetails.xml这个文件,bt_education这个是我现在用的模板文件,其他的都大同小异。有29个模块位置,跟我们在预览中看的一致。

    <positions>
        <!-- 29 module positions -->
        <position>logo</position>
        <position>top</position>
        <position>social</position>
        <position>menu</position>
        <position>slideshow</position>
        <position>header1</position>
        <position>header2</position>
        <position>header3</position>
        <position>left</position>
        <position>newsflash</position>
        <position>news1</position>
        <position>news2</position>
        <position>news3</position>
        <position>pathway</position>
        <position>notice1</position>
        <position>notice2</position>
        <position>notice3</position>
        <position>banner</position>        
        <position>right</position>
        <position>bottom1</position>
        <position>bottom2</position>
        <position>bottom3</position>
        <position>footer1</position>
        <position>footer2</position>
        <position>footer3</position>
        <position>btlogo</position>
        <position>footer4</position>
        <position>footer5</position>
        <position>debug</position>
    </positions>

很多人可能想问如何新建一个模块位置放置自己的模块,挺简单,但是目前还没有必要,后续用到的时候我会记录。上面的模块位置已经很多了,仔细的朋友在网站上会看到其实有很多模块位置还没有使用。

<body>

<div id="outer" style="width: <?php echo $bt->full_width + 30; ?>px;">

  <div id="inner" style="width: <?php echo $bt->full_width; ?>px;">

    <?php
        // BEGIN: Logo, Top, Social
        echo $bt->getPosition('logo_top_social', array('logo'=>$bt->logo_width, 'top'=>$bt->top_width, 'social'=>$bt->social_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '10', '10', '10', '10');
        // END: Logo, Top, Social
        ?>

        <div class="clearfix"></div>

    <?php
        // BEGIN: Menu
        echo $bt->getPosition('menu', array('menu'=>$bt->menu_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '20', '0', '20', '0');
        // END: Menu
        ?>

        <div class="clearfix"></div>

    <?php
        // BEGIN: Slideshow
    if ($bt->display_header) {
      $slideshow_rounded_corners = 'left_top_right_top_rounded_corners';
    }else{
      $slideshow_rounded_corners = 'full_rounded_corners';    
    }
    echo '<div id="bt_slideshow_div_rounded_corners" class="'.$slideshow_rounded_corners.'">';
    echo $bt->getPosition('slideshow', array('slideshow'=>$bt->slideshow_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '0', '0', '0', '0');
    echo '</div>';
    // END: Slideshow
        ?>

        <?php
    if ($bt->display_slideshow) {
          echo '<div id="header_with_slideshow">';
        }else if ($bt->display_header) {
          echo '<div id="only_header">';
    }else{
      echo '';
    }
    // BEGIN: Header
    echo $bt->getPosition('header', array('header1'=>$bt->header1_width, 'header2'=>$bt->header2_width, 'header3'=>$bt->header3_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '0', '0', '0', '0');
    // END: Header
    
    if ($bt->display_slideshow) {
          echo '</div>';
        }else if ($bt->display_header) {
          echo '</div>';
    }else{
      echo '';
    }
    ?>
        
        <div id="main">
    <?php
        // rounded corners
        if ($bt->display_left) {
            $rounded_corners = "edu";
            $brdr = "right_brdr";
            $bt->bt_main_outer_width = $bt->bt_main_outer_width - 1;
        }else if ($bt->display_right){
            $rounded_corners = "edu";
            $brdr = "left_brdr";
            $bt->bt_main_outer_width = $bt->bt_main_outer_width - 1;
        }else{
            $rounded_corners = "edu_full";
            $brdr = "no_brdr";
        }
        ?>

    <table border="0" cellpadding="0" cellspacing="0" id="main_table">
          <tr>
      
      <?php
      // BEGIN: Left
      if ($bt->display_left) {
      echo '<td valign="top" id="left_col" class="edu '.$brdr.'">';
        echo $bt->getPosition('left', array('left'=>$bt->left_width), $bt->left_width, 'vertical', '0', '0', '0', '0', '0', '0', '0', '0');
             echo '</td>';
      }
      // END: Left
      ?>
             
            <td valign="top" id="main_col" class="<?php echo $rounded_corners; ?>">
            
            <div id="body" style="width: <?php echo $bt->bt_main_outer_width;?>px">
        <?php
                // BEGIN: Newsflash
                echo $bt->getPosition('newsflash', array('newsflash'=>$bt->bt_main_outer_width), $bt->bt_main_outer_width, 'horizontal', '0', '0', '0', '0', '15', '15', '0', '15');
                // END: Newsflash
            
                // BEGIN: News
                echo $bt->getPosition('news', array('news1'=>$bt->news1_width, 'news2'=>$bt->news2_width, 'news3'=>$bt->news3_width), $bt->bt_main_outer_width, 'horizontal', '0', '0', '0', '0', '15', '15', '0', '15');
                // END: News
                
                // BEGIN: Pathway
                echo $bt->getPosition('pathway', array('pathway'=>$bt->bt_main_outer_width), $bt->bt_main_outer_width, 'horizontal', '0', '0', '0', '0', '15', '15', '0', '15');
                // END: Pathway
                
                // BEGIN: Mainbody
                echo $bt->getPosition('mainbody', array('mainbody'=>''), $bt->bt_main_outer_width, 'horizontal', '0', '0', '0', '0', '10', '15', '0', '15');
                // END: Mainbody
            
                // BEGIN: Notice
                echo $bt->getPosition('notice', array('notice1'=>$bt->notice1_width, 'notice2'=>$bt->notice2_width, 'notice3'=>$bt->notice3_width), $bt->bt_main_outer_width, 'horizontal', '0', '0', '0', '0', '10', '15', '0', '15');  
                // END: Notice
            
                // BEGIN: Banner
                echo $bt->getPosition('banner', array('banner'=>$bt->bt_main_outer_width), $bt->bt_main_outer_width, 'horizontal', '0', '0', '0', '0', '10', '15', '0', '15');
                // END: Banner
              ?>
                <div class="clearfix"></div>
            </div>
                
            </td>
            
            <?php
            // BEGIN: Right
            if ($bt->display_right) {
              echo '<td valign="top" id="right_col" class="edu '.$brdr.'">';
          echo $bt->getPosition('right', array('right'=>$bt->right_width), $bt->right_width, 'vertical', '0', '0', '0', '0', '0', '0', '0', '0');
              echo '</td>';
      }
            // END: Right
            ?>
            
            </tr>
        </table>
    </div>
        
    <?php
    // BEGIN: Bottom
    echo $bt->getPosition('bottom', array('bottom1'=>$bt->bottom1_width, 'bottom2'=>$bt->bottom2_width, 'bottom3'=>$bt->bottom3_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '10', '15', '0', '15');
    // END: Bottom
    ?>  
        
        <div class="clearfix"></div>
     
    <?php
    // BEGIN: Footer One
    echo $bt->getPosition('footer_one', array('footer1'=>$bt->footer1_width, 'footer2'=>$bt->footer2_width, 'footer3'=>$bt->footer3_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '10', '15', '0', '15');
    // END: Footer One
    ?>
    
        <div class="clearfix"></div>
            <?php
    // BEGIN: Footer Two
    echo $bt->getPosition('footer_two', array('footer4'=>$bt->footer4_width, 'footer5'=>$bt->footer5_width), $bt->full_width, 'horizontal', '0', '0', '0', '0', '10', '15', '0', '15');
    // END: Footer Two
    ?>

        <div class="clearfix"></div>

    </div>

</div>


<div id="bottom_line_bg"></div>  

<?php
// BEGIN Go top button
if ($bt->display_gotop) {
  echo $bt->bt_gotop;
}
// END Go top button
?>

 <jdoc:include type="modules" name="debug" />

</body>

我把主页模板的body部分先给大家看一下,就会大概明白了模块是如何显示在页面上的。

下面我们新建一个模块来说明。那就是menu模块。

保存后我们到前台看看效果:

伤心啊,怎么这个样子,看样子模板的css样式表没有运用到模块上面,那如何将它运用上呢,我们在模块管理中刚才新建的模块高级选项》菜单标签中加入标签:bt_nav_menu,保存后看看是不是像样子了?

抱歉!评论已关闭.