Trouble creating custom joomla template - template not appearing in admin

Hi, I'm creating my first joomla template and I've followed the instructions of this tutorial:

http://docs.joomla.org/Tutorial:Creating_a_basic_Joomla!_template

However, despite my creating the folder "custom" in /templates and putting these files in:

/templates/custom/templateDetails.xml
/templates/custom/index.php

...  It doesn't appear when I go to "templates" when logged in as admin.  The other templates (preinstalled) do show up, but not the one I just created...
LVL 14
EMB01Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
joomla_phpConnect With a Mentor Commented:
Do the first steps, creating index.php and templateDetails.xml.

In templateDetails.xml, in this section:

 <files>
                <filename>index.php</filename>
                <filename>component.php</filename>
                <filename>templateDetails.xml</filename>
                <filename>template_thumbnail.png</filename>
                <filename>images/background.png</filename>
                <filename>css/template.css</filename>
        </files>
       

Remove lines so it looks like this instead:

 <files>
                <filename>index.php</filename>
                <filename>templateDetails.xml</filename>
</files>
       

Assuming you're on Windows (not mac or linux) ...

Go get 7-zip, install it.

Start, run, cmd

cd to the directory containing "custom"


C:\yourdirectory>"c:\program files\7-zip\7z" a custom.zip custom

That line says:

Use 7z.exe to create custom.zip from the contents of the custom directory.

You've now created custom.zip.

Now go to your joomla install area, install custom.zip.

Go to your templates area, set mynewtemplate as your default template.

0
 
EMB01Author Commented:
Okay, thanks.  So, how do I go about updating the template?  Do I have to zip and upload it this way every time?
0
 
joomla_phpCommented:
technically you can change the index.php, add a link to css, add a css -- you don't have to zip it each time.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
EMB01Author Commented:
What about when changing the XML?  Does that have to be zipped each time?  I would love to be able to update the template via FTP like when doing a normal website.
0
 
joomla_phpCommented:
the xml is only for installation. once the template is the default you can mess with its component files without re-installing.
0
 
EMB01Author Commented:
I just tried to change the index.php page and uploaded it via FTP but no changes were evident when I refreshed the page in the web browser.  What am I doing wrong to update the index.php page?
0
 
joomla_phpCommented:
I didn't say it would work - I only said that you'd be able to see it in the administrator.

You still have to do the rest of the work.

Don't forget we removed items from xml that need to be put back to continue the tutorial.
0
 
EMB01Author Commented:
So, FTP updates won't work?  To clarify, I'm asking you how can I make changes to the code of the template (not the article content).  Do I need to re-package and uploaded through the UI?
0
 
joomla_phpCommented:
I might have misunderstood you -- given the work we've done so far, you will get a blank page when yhou load the template.

I also mis-spoke. You do want to get to the point where you have added back in the lines we deleted in the xml, make an installation out of that, and re-install.

You need those other files.

I was just getting you to where you could see it in the admin.

0
 
Panagiotis Sweb developer - designer Commented:
in templateDetails.xml you have to put

<name>the name of your template</name>

for your template
<name>custom</name>


0
 
joomla_phpCommented:
that's in the original tutorial, i didn't change it. It works the way it is, mynewtemplate, but it can be changed to custom as well.
0
 
EMB01Author Commented:
Okay, thanks for your help so far.  How do I get my externals such as images, javascript and css to work?  I tried adding them to the xml file:

        <files>
                <filename>index.php</filename>
                <filename>templateDetails.xml</filename>
                <filename>css/mscarousel.css</filename>
      <filename>css/nav.css</filename>
      <filename>jquery-1.4.4.js</filename>
      <filename>jquery.msCarousel2.js</filename>
        </files>

But, it acts like they're not there.  I also tried FTP'ing them but it still doesn't seem to work.
0
 
Panagiotis Sweb developer - designer Commented:
it does not really matters all the other stuff

if you have the tag name as your template name then in the administrator under the template manager you will see your template

0
 
joomla_phpCommented:
I think that question is too big to answer. I'd have to write the tutorial here.
0
 
EMB01Author Commented:
Please, is it written somewhere online?.. throw me a bone here...
0
 
joomla_phpCommented:
Sorry in no way meant to give you a hard time, I figured that what you wanted was in that tutorial.

I don't have any specific resources that you couldn't find on Google yourself.

If it were me, I would open ja_purity index.php, see how that works, then apply those concepts to custom.

Would you like to give that a try?

0
 
EMB01Author Commented:
Sure, I'll download that file and look at it; but I just feel like I'm missing something small.  I already uploaded the files to the server and listed them in the XML file, so I don't know what else I could possibly need to do in order for the files to be recognized...
0
 
joomla_phpCommented:
Make sure you have an article assigned to the front page, and modules assigned to "top" and to "bottom" positions.

Create directory OUTSIDE of your template area, in a work area, called mynewtemplate.

In that:

index.php
<?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>hello
top<jdoc:include type="modules" name="top" />
component<jdoc:include type="component" />
bottom<jdoc:include type="modules" name="bottom" />
</body>
</html>


index.html
<html><body bgcolor="#FFFFFF"></body></html>







templateDetails.xml
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="template">
      <name>mynewtemplate</name>
      <version>1.0.0</version>
      <creationDate>02/26/2011</creationDate>
      <author>example.com</author>
      <authorEmail>you@example.com</authorEmail>
      <authorUrl>http://www.example.com.com</authorUrl>
      <copyright></copyright>
      <license>GNU/GPL version 2</license>
      <description>my new template</description>
<files>
            <filename>index.html</filename>
            <filename>index.php</filename>
            <filename>templateDetails.xml</filename>
      </files>
      <css>
            <filename>css/template.css</filename>
      </css>
      <positions>
            <position>top</position>
            <position>bottom</position>
      </positions>

</install>


css/template.css
body { background-color:blue; color:white;}



zip the directory at the command line using 7-zip's 7z.exe:

C:\xampp\htdocs\work>"c:\program files\7-zip\7z.exe" a mynewtemplate.zip .\mynew
template


0
 
EMB01Author Commented:
Thanks for your help.  The problem was a simple pathing issue; which I've resolved.  However, I'm still wondering about home page / article pages.  Do both exist in index.php?  For instance:

<?php
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
        echo 'This is the home page';
} else {
        echo 'This is NOT the home page';
}
?>
0
 
joomla_phpCommented:
The jdoc component spits out the article content. The content for the home page will display on the home page, the content for other menu items will display on their respective pages wherever the component jdoc tells it to. Determining the home page as you did there will not affect the content unless you say something like:

<?php
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
       ?><jdoc:include type="component" /><?php
} else {
        echo 'This is NOT the home page and therefore you get no content';
}
?>
0
 
EMB01Author Commented:
It's just that I have two different layouts, one for the home page and one for the article pages.  How do I specify this so that joomla knows which to use?  Do you want me to open a new question for this question?
0
 
joomla_phpCommented:
yes
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.