开发者

How to create a Joomla template?

开发者 https://www.devze.com 2022-12-17 20:00 出处:网络
I am working on my first joomla template but there are certain things that are confusing me. I want the template to work as having three column layout in the home page and then there are two column la

I am working on my first joomla template but there are certain things that are confusing me. I want the template to work as having three column layout in the home page and then there are two column layout pages in the website. Another page also has three column layout. So i was wondering how would I implement this runtime layout switching in my Joomla template. I开发者_运维技巧 have created a basic template with two column layout but I dont know how to do the runtime switching. Can someone suggest something easier and quicker?


mck89 is right.. also you can hide areas based on how much content is in them...

Something like this (pseudo-code):

<html>
<head>
  <title>My test</title>
</head>
<body>
  <table>
    <tr>
      <td><jdoc:include type="modules" name="left" style="xhtml" /></td>
      <td><jdoc:include type="modules" name="main" style="xhtml" /></td>

      <?php if ($this->countModules( 'right' )) : ?>
        <td><jdoc:include type="modules" name="right" style="xhtml" /></td>
      <?php endif; ?>
     </tr>
  </table>
</body>
</html>


You can use multiple templates for one site.

Use menu assignment functionality of the joomla..

Your home page template should be default template.

And you can switch to other templates based on the menu selection.


You can create 2 templates one with two columns and one with three columns. Then you go in the administration and go in the template management (you can find it in the extensions menu), you chose the 2 columns template as the default one and then assign the three columns template to the pages that must have this one.


There is a good book on Joomla!, Building Websites with Joomla! 1.5, which also covers template design - might be helpful.


You can easily create templates for Joomla in just 15 minutes. Here I give you code to create a Joomla template. It is very useful, too.

<?php defined( '_JEXEC' ) or die( 'Restricted access' );?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
   xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/mynewtemplate/css/template.css" type="text/css" />
</head>
<body>
<jdoc:include type="modules" name="top" /> 
<jdoc:include type="component" />
<jdoc:include type="modules" name="bottom" />
</body>
</html>


Instead of using different templates for your different layouts you might use a template framework that automatically adapts to your needed number of columns. JYAML and bootstrap (google for Joostrap) would be two good examples for that.

Those frameworks detect which module positions are used on each page and ommit the not needed columns.

0

精彩评论

暂无评论...
验证码 换一张
取 消