Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

[HOW TO] TEMPLATE COMPONENT WITHOUT OVERWRITING 03 Mar 2013 09:43 #6895

  • JoomGuy
  • JoomGuy's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hey cooks,

Thanks to cook, building the application layer of your components is far less time consuming - in fact, its a breeze. With all of the heavy lifting taken care of by cook for this, now, the most time consuming part of developing your component will probably be implementing a functional UI: styling your component's output and coding some nice app-like JS features. With that can sometimes come some painful merging of views & layouts that can also lead to mistakes and loss of work if you're not careful. This is UNDESIRABLE!!!

Therefore, I thought I'd share a sometimes overlooked way of templating your component that will help minimise overwriting your modifications during the design phase and every time you rebuild in Cook. Naturally, an IDE will help you with this massively but that's a different subject. If you're considering an IDE or want to share your experience with one, please go here: www.j-cook.pro/forum/33-developper-resso...-for-php-development

So, you're almost certainly aware of template overrides in joomla, whether or not you've implemented them before or not. To summarise, a template override is almost a 'clone' of some (or all) views/layouts of a component or module that has been rearranged and/or re-styled . Creating a template override is a simple as copying all of the layouts from your view's tmpl folder into your template/html/component_name/view_name/layout.php then adjusting their output as required.

So, if you follow this method of styling your component (and possibly its modules), you can keep all of your modifications in tact and at the end of your project, you could replace all of your component's views/layouts with those in the template overrides. All you have to do then is repackage it and you're done!

N.B. Template overrides will only work in the active template so, if you want to develop a component that works out-of-the-box in the default template for your J! version, add the overrides to that template.

Further reading:
  1. Joomla 2.5: docs.joomla.org/Layout_Overrides_in_Joomla_2.5
  2. Joomla 3.0: forum.joomla.org/viewforum.php?f=718
  3. docs.joomla.org/How_to_override_the_outp...rom_the_Joomla!_core
Hope it helps,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin, BTB300

Please Log in or Create an account to join the conversation.

Last edit: by JoomGuy. Reason: BB Code error fixed
  • Page:
  • 1
Time to create page: 0.048 seconds

Let me first state that this is an amazing and fascinating product exactly what I was looking for. In just a few hours (listening to the very well made and clearly understandable videos learning doing) I completed and installed my first component. I am now in the second refining phase. I will make a recommenation in JED. Thanks for the effort in creating such a great product. Incidentally some of the best Joomla extension I use are of French origin !
Giori (Forum)

Get Started