Jump to content

Building own Joomla template?


turpentyne

Recommended Posts

Joomla is an entirely new realm for me. I'm not finding a template that does what I want, so I'm trying to figure out how to set up a template. I found a couple basic tutorials, and some sample script which I'm trying to manipulate to get the hang of things. But I'm stuck at how to make modules show. I know how to work it in the admin area, but the code is where I'm lost. I've followed the instructions of creating an xml file, and designating the positions in it. Then I put those same positions in the index.php file, but nothing appears? I get the <jdoc:include type="component" /> every time, but what i've added in:

 

<?php if($this->countModules('left1')) : ?>

    <jdoc:include type="modules" name="left1" style="xhtml"/>

    <?php endif; ?>

 

seems to give me nothing. Not sure what I'm missing on it.

 

I took the if statement out and still don't get anything with just <jdoc:include type="modules" name="left1" style="xhtml"/>

 

In admin, I've applied modules to those positions in that template. I've made sure the template is active and applied to the page. Not sure how to do this..

 

    <?php
    /**
    * @version Simplicity 1.0
    * @copyright Copyright (C) 2012 MergeCreate
    * @license GNU General Public License version 2 or later; see LICENSE.txt
    */
    defined('_JEXEC') or die;
    /* The following line loads the MooTools JavaScript Library */
    JHTML::_('behavior.framework', false);
    /* The following line gets the application object for things like displaying the site name */
    $app = JFactory::getApplication();
    /* Template variables */
    $interactText = $this->params->get('interactText');
    $templateColor = $this->params->get('templateColor');
    $showAuthor = $this->params->get('showAuthor');
    $showEmail = $this->params->get('showEmail');
    $showFacebook = $this->params->get('showFacebook');
    $showRSS = $this->params->get('showRSS');
    $showTwitter = $this->params->get('showTwitter');
    $emailUrl = $this->params->get('emailURL');
    $facebookUrl = $this->params->get('facebookURL');
    $rssUrl = $this->params->get('rssURL');
    $twitterUrl = $this->params->get('twitterURL');
    ?>
    <?php echo '<?'; ?>xml version="1.0" encoding="<?php echo $this->_charset ?>"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
    <head>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/default.css" type="text/css" />
    <link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/<?php echo $templateColor;?>.css" type="text/css" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    </head>
    <body>
    <div id="topBar">
    
    <div id="top">
    <br /><br />
    <jdoc:include type="modules" name="top0" style="xhtml"/>
    </div>
    
    
    <img src="<?php echo $this->baseurl; ?>/templates/redwhites_template1/images/logo1.gif" alt="Custom image" class="customImage" />
     
    <div id="top2left" style="float:left;">

    <jdoc:include type="modules" name="top1left" style="xhtml"/>
    </div>
    
    
    
    <div id="top2right" style="float:right;border:#900; border-width:medium; ">
    <jdoc:include type="modules" name="top2right" style="xhtml"/>
    </div>
    
    
    
    <div id="top2left" style="float:left;border-width:medium;">
    <jdoc:include type="modules" name="top2left" style="xhtml"/>
    </div>
    
    <div id="top2right" style="float:right;border-width:medium;">
    <jdoc:include type="modules" name="top2right" style="xhtml"/>
    </div>
   
    
    
    <div id="topWrapper"><table border=3><tr><td>
    
    <div id="top3">
    <jdoc:include type="modules" name="top3" style="xhtml"/>
    </td></tr></table>
    </div>
   
    
   
    
    
    <div id="search">
    <jdoc:include type="modules" name="search" style="xhtml"/>
    </div>
   
    </div>
    </div>
    <div id="mainContainer">
    test 3
    <div id="mainWrapper">
    <div id="main">
    <div id="right" style="float:left;">
    <jdoc:include type="modules" name="left1" style="xhtml"/>
    

    
    <jdoc:include type="modules" name="left2" style="xhtml"/>
   
      
    <jdoc:include type="modules" name="left3" style="xhtml"/>
    
    </div>
    <div id="center" style="float:left;">
    
    <jdoc:include type="modules" name="middle1" style="xhtml"/>
    
    
    <jdoc:include type="modules" name="middle2" style="xhtml"/>
   
      
    <jdoc:include type="modules" name="middle3" style="xhtml"/>
    
    </div>
    
     <div id="right" style="float:left;">
    
    <jdoc:include type="modules" name="right1" style="xhtml"/>
    
    
    <jdoc:include type="modules" name="right2" style="xhtml"/>
    
     
    <jdoc:include type="modules" name="right3" style="xhtml"/>
    
    </div><br />
    
    
    <jdoc:include type="component" />
    <div id="footleft" style="float:left;">
    
    <jdoc:include type="modules" name="footer1left" style="xhtml"/>
    
    </div>
    
    <div id="footright" style="float:left;">
     
    <jdoc:include type="modules" name="footer1right" style="xhtml"/>
    
    </div>
    
    <jdoc:include type="modules" name="footer2" style="xhtml"/>
    
    </div>
    <div id="sidebar">
    <?php if (($showRSS == 0)||($showFacebook == 0)||($showTwitter == 0)||($showEmail == 0)):?>
    <?php if (!empty($interactText)):?>
    <h2><?php echo $interactText; ?></h2>
    
    <?php endif; ?>
    <ul id="interact">
    <?php if (($showRSS == 0)&&(!empty($rssUrl))):?>
    <li><a href="<?php echo $rssUrl; ?>" class="rss"></a></li>
    <?php endif; ?>
    <?php if (($showFacebook == 0)&&(!empty($facebookUrl))):?>
    <li><a href="<?php echo $facebookUrl; ?>" class="facebook"></a></li>
    <?php endif; ?>
    <?php if (($showTwitter == 0)&&(!empty($twitterUrl))):?>
    <li><a href="http://twitter.com/<?php echo $twitterUrl; ?>" class="twitter"></a></li>
    <?php endif; ?>
    <?php if (($showEmail == 0)&&(!empty($emailUrl))):?>
    <li><a href="<?php echo $emailUrl; ?>" class="email"></a></li>
    <?php endif; ?>
    </ul>
    <?php endif; ?>
    
    <jdoc:include type="modules" name="right2" style="xhtml"/>
    
    </div>
    <div id="footer">
    
    <jdoc:include type="modules" name="footer" style="xhtml"/>
    
    </div>
    <div id="copyright">
    <p>©<?php echo date('Y'); ?> <?php echo $app->getCfg('sitename'); ?>.
    <?php if ($showAuthor == 0):?>
    Designed and created by <a href="http://www.patrickmediagroup.com/">Patrick Media Group</a>.
    <?php endif; ?>
    </p>
   
    </div>
    
    </div>
    
    </div>
    </body>
    </html>

 

 

The xml is:

 

<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="template">
<name>Redwhites</name>
<creationDate>03/28/12</creationDate>
<author>MergeCreate - Charles</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://www.patrickmediagroup.com/</authorUrl>
<copyright>Copyright (C) 2012 MergeCreate</copyright>
<license>GNU/GPL</license>
<version>1.0.0</version>
<description>Charles template v2</description>
<files>
<folder>css</folder>
<folder>images</folder>
<folder>language</folder>
<filename>index.php</filename>
<filename>index.html</filename>
<filename>favicon.ico</filename>
<filename>templateDetails.xml</filename>
<filename>template_preview.png</filename>
<filename>template_thumbnail.png</filename>
<filename>logo1.png</filename>
</files>
<positions>
<position>top0</position>
<position>top1left</position>
<position>top2left</position>
<position>top2right</position>
<position>top3</position>
<position>breadcrumb</position>
<position>authorbox</position>
<position>left1</position>
<position>middle1</position>
<position>right1</position>
<position>left2</position>
<position>middle2</position>
<position>right2</position>
<position>left3</position>
<position>middle3</position>
<position>right3</position>
<position>footer1left</position>
<position>footer1right</position>
<position>footer2</position>
</positions>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.tpl_simplicity.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="advanced">
<field name="templateColor" type="list" default="gray" label="TPL_SIMPLICITY_TEMPLATE_COLOR" description="" filter="word">
<option value="gray">TPL_SIMPLICITY_TEMPLATE_COLOR_GRAY</option>
<option value="red">TPL_SIMPLICITY_TEMPLATE_COLOR_RED</option>
<option value="blue">TPL_SIMPLICITY_TEMPLATE_COLOR_BLUE</option>
<option value="lime">TPL_SIMPLICITY_TEMPLATE_COLOR_LIME</option>
<option value="purple">TPL_SIMPLICITY_TEMPLATE_COLOR_PURPLE</option>
</field>
<field name="showAuthor" type="radio" default="0" label="TPL_SIMPLICITY_SHOW_AUTHOR_CREDITS" description="">
<option value="0">Show</option>
<option value="1">Hide</option>
</field>
<field name="interactText" type="input" label="TPL_SIMPLICITY_INTERACT_TEXT" default="Interact"></field>
<field name="showRSS" type="radio" default="0" label="TPL_SIMPLICITY_SHOW_RSS" description="">
<option value="0">Show</option>
<option value="1">Hide</option>
</field>
<field name="rssURL" type="input" label="TPL_SIMPLICITY_RSS_URL"></field>
<field name="showFacebook" type="radio" default="0" label="TPL_SIMPLICITY_SHOW_FACEBOOK" description="">
<option value="0">Show</option>
<option value="1">Hide</option>
</field>
<field name="facebookURL" type="input" label="TPL_SIMPLICITY_FACEBOOK_URL"></field>
<field name="showTwitter" type="radio" default="0" label="TPL_SIMPLICITY_SHOW_TWITTER" description="">
<option value="0">Show</option>
<option value="1">Hide</option>
</field>
<field name="twitterURL" type="input" label="TPL_SIMPLICITY_TWITTER_URL"></field>
<field name="showEmail" type="radio" default="0" label="TPL_SIMPLICITY_SHOW_EMAIL" description="">
<option value="0">Show</option>
<option value="1">Hide</option>
</field>
<field name="emailURL" type="input" label="TPL_SIMPLICITY_EMAIL_URL"></field>
</fieldset>
</fields>
</config>
</extension>

Link to comment
https://forums.phpfreaks.com/topic/258760-building-own-joomla-template/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.