Counter Productive Theming System

Please see sticky inside.
Locked
Rowan
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Sun Feb 11, 2007 9:26 am

Counter Productive Theming System

Post by Rowan » Tue Jun 26, 2007 10:37 am

Creating a template in Joomla 1.0.X is fast, limited and risky, but at least it's fast. In 1.5 it's slow, but flexible and safe.

In 1.5 you can override just about any HTML output you desire without worrying about future upgrades, this gives you flexibility and safety. The slow part comes from the fact that each component page requires its own individual template file, whether it's a page that lists teasers of articles, or a page for a single article. This wouldn't be a problem if each page used clean, semantic markup, unfortunately it doesn't.

Unless Joomla 1.5 implements intuitive, consistent and standardised HTML markup for its front end, then I doubt I'd ever have the patience to create a template myself. I've played with the included Beez template and while it's better than Joomla's default, it isn't perfect (yet), making a trivial change to the HTML still means editing several pages for consistency.

What sort of improvements can we expect in the future to make theming just as fast as it is in 1.0.x?

noahisaac
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Tue May 01, 2007 9:10 pm

Re: Counter Productive Theming System

Post by noahisaac » Tue Jun 26, 2007 9:28 pm

Hi Rowan -

You can create a template just as fast in 1.5 as in 1.0.12.  You don't have to use any of the html overrides.  If you don't, the output can be very similar to 1.0.12 (modules in XHTML, content using tables).  Creating a template that generates only XHTML output (with no tables) could take you longer, if you re-wrote all the html overrides by hand. 

When I wanted to make a totally XHTML template in 1.5, I chose to just make a copy of the beez template, and work from there.  I stripped out the default layout and css from the index.php and put in my own.  Problem solved.  It didn't take me much longer than creating a template in 1.0.12, but it has the added benefit of being totally XHTML compliant.

Of course, I'd love to see the core re-written to get rid of tables entirely, but I guess I can wait for version 2.0.


- Noah

Rowan
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Sun Feb 11, 2007 9:26 am

Re: Counter Productive Theming System

Post by Rowan » Wed Jun 27, 2007 9:45 am

noahisaac wrote: When I wanted to make a totally XHTML template in 1.5, I chose to just make a copy of the beez template, and work from there.  I stripped out the default layout and css from the index.php and put in my own.
The problem though, is if the Beez template (or any other template) has some HTML in a component page that needs to be changed, you have to make the same change in nearly every other component page that uses the same or similar HTML. A lot of pages share nearly identical code yet they're still served independently.

Drupal handles this well, you start with node.tpl.php and if you want to make a specific template for another node type you just copy node.tpl.php, rename it as node-product.tpl.php and make whatever changes you like. If you do it properly from the start you shouldn't have to make many further changes.

pdelbar
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Sun Nov 06, 2005 8:49 am

Re: Counter Productive Theming System

Post by pdelbar » Wed Jun 27, 2007 10:16 am

Drupal handles this well, you start with node.tpl.php and if you want to make a specific template for another node type you just copy node.tpl.php, rename it as node-product.tpl.php and make whatever changes you like.
Eh ... doesn't that mean you have to do the same change everywhere again, like you suggest is the case for joomla! ?

It's hard to compare Drupal here. As long as you work from the node base, you can 'inherit' (sorry to use the term inheritance in the Drupal context, should have used 'copy'  ;) ) stuff ... but in practice, you end up doing the same changes downstream from there. If there would be some other hierarchical template inheritance mechanism, it would still be difficult to strike a balance between cases where you want to make a single change in one part of the template (eg. for one module) and cases where you want a general change.

Since 1.5 allows you to create overrides, I don't see why you couldn't implement your own 'standard' layout by structuring the code for your templates, reusing common pieces ...

noahisaac
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Tue May 01, 2007 9:10 pm

Re: Counter Productive Theming System

Post by noahisaac » Wed Jun 27, 2007 1:51 pm

The problem though, is if the Beez template (or any other template) has some HTML in a component page that needs to be changed, you have to make the same change in nearly every other component page that uses the same or similar HTML. A lot of pages share nearly identical code yet they're still served independently.
I'm not sure I follow you.  1) components are not templates and templates are not components.  They are independent of one another.  The beez template itself does not have any components.  2) Why would you need to make changes in multiple places?  Are you using CSS?

Template creation in 1.5 can be EXACTLY the same as 1.0.12.  All 1.0.x templates are forward compatible to 1.5. 

If you want to make a template for Joomla 1.5 that takes advantage of its new features, you still create a template in the same way you would in 1.0.12, but your module and content calls use a new format.  You just substitute 1 for 1, like this:

                  =>   
      =>   
                  =>   


HTML overrides are NOT supposed to be used to create a template.  They were created as a way to modify or override core output.  They were designed to prevent people from having to hack the core.  In this way, it's easier to upgrade to a new version of Joomla (you don't have to re-hack the core with each new version). 

The beez template uses HTML overrides to eliminate tables from the core output.  It does not use HTML overrides to do any layout or formatting. 

To reiterate: Layout and formatting should be done in index.php and your CSS stylesheets (not using any HTML overrides or other modifications of core output).

Rowan
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Sun Feb 11, 2007 9:26 am

Re: Counter Productive Theming System

Post by Rowan » Fri Jun 29, 2007 10:53 am

∓quot;noahisaac"\ wrote:
The problem though, is if the Beez template (or any other template) has some HTML in a component page that needs to be changed, you have to make the same change in nearly every other component page that uses the same or similar HTML. A lot of pages share nearly identical code yet they're still served independently.
I'm not sure I follow you.  1) components are not templates and templates are not components. They are independent of one another. The beez template itself does not have any components.  2) Why would you need to make changes in multiple places?  Are you using CSS?
Components have templates, you have to modify the component template if you want to change the HTML it outputs. I'm not talking about using HTML styling in pages, but simply modifying HTML tags and their ordering in the document markup. Perhaps I should have  used the term "component template" rather than "component page".
∓quot;noahisaac"\ wrote:HTML overrides are NOT supposed to be used to create a template. They were created as a way to modify or override core output.
Component templates only seem to allow you to modify HTML or bits and pieces of PHP.
∓quot;noahisaac"\ wrote:The beez template uses HTML overrides to eliminate tables from the core output. It does not use HTML overrides to do any layout or formatting.
By removing tables and other tag soup it is effectively changing the layout and formatting, then replacing bad HTML with better HTML.

Here's the process of making a trivial HTML change in 1.5:
  • In com_content, there are five 'views', each view - archive, article, category, frontpage and section - contains several templates.
  • In the frontpage view there are templates named default, default_item and default_links
  • If I add an H2 in default, I would have to add it to default_item for consistency.
  • Then also for consistency, I would have to open up the default article view and add the H2 there as well.
  • Then I would open the archive view and make the same change to default and default_items.
This process can take an extremely long time, and it still applies to the Beez template for when you need to change a common tag.

Rowan
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Sun Feb 11, 2007 9:26 am

Re: Counter Productive Theming System

Post by Rowan » Fri Jun 29, 2007 11:01 am

Eh ... doesn't that mean you have to do the same change everywhere again, like you suggest is the case for joomla! ?
You rarely need to create more than a few node templates in Drupal thanks to the clean and reusable HTML, plus PHPTemplate. You also have the advantage of starting with a single node template and making sure it's right before reusing it for other node types.
Since 1.5 allows you to create overrides, I don't see why you couldn't implement your own 'standard' layout by structuring the code for your templates, reusing common pieces.
I would if I had _that_much_ time.

AmyStephen
Joomla! Champion
Joomla! Champion
Posts: 7056
Joined: Wed Nov 22, 2006 3:35 pm
Location: Nebraska
Contact:

Re: Counter Productive Theming System

Post by AmyStephen » Sat Jun 30, 2007 12:05 pm

Rowan wrote: I would if I had _that_much_ time.
I have not tried it yet but was hoping that reusing the Beez template would give a good head start and cut the time for development significantly. Hope so, anyway, since the template override system is something I need to use and am very pleased to see in J! v 1.5.

I believe you should be able to create a standard layout for components and modules, like Noah is suggesting, reuse it with your websites and achieve different looks using your CSS.

Very cool feature of v 1.5 - nearly as nice as the SEF URLs! ;)
Amy


Locked

Return to “Joomla! 1.5 BETA 2”