2

I am really confused about these 2 concepts. I am basically wanting to change the appearance of the Joomla category page that lists the sub-categories in it. I dont like the default "Alternative Layout" options of Blog and List type. I want to show the sub-categories with an image + sub-category title style similar to some Portfolio layouts I've seen. So I started googling and reading a few docs on how to do this. During this time, I came across the Layout Overrides in Joomla which says that we can create alternative Joomla Layouts to display Modules, components, Category and Menu Items.

Q1) So does this mean that I can create a new layout (for portfolio category as an example) and if I place them inside "templates/myTemplate/html/com_contact/category" folder this layout option will be listed under Alternative Layout drop-down list in admin panel?

While I was reading some more, I then came across the K2 method where it says that K2 allows creating sub-templates to have different styles for each categories. I havent decided if I am going to use K2 or the core Joomla articles. But my main concern is to style some category pages differently to the default blog or list options. When I read the above article, I thought this can be done in Joomla core itself. But when I read the K2 article on Templating with K2 (and the concepts of sub-templates), it said that the core Joomla doesnt allow sub-templating and K2 can do that.

Q2) What is the difference between creating sub-templates for K2 categories and creating custom template layouts for Joomla categories?

I am totally confused here. If Joomla allows to create different layouts for categories which can then be chosen from the admin panel on what layout to use for that category, what is so special about K2's sub-templating which claims that only K2 allows the flexibility of choosing a different layout for different categories?

Can someone help me understand this please? I have been searching to understand the difference for several hours and I am still stuck on this...

I am new to Joomla and I am using the Joomla version 3.3.

Shaz
  • 2,647
  • 2
  • 35
  • 45
Neel
  • 9,352
  • 23
  • 87
  • 128
  • 1
    1. That's right, you can create layouts like that. As far as I know Joomla! versions under 3.x didn't allow subtemplating as K2 did/does. 2. There is no difference in my opinion, besides that they are two different joomla components and that K2 allows also a custom css file per custom template. – Shaz May 26 '14 at 05:20
  • That's so helpful Shaz. This was really hard to find anywhere since all articles that explained about K2 sub-templating comparing with Joomla didint mention what version of Joomla it is referring to. Now I noticed that a lot has changed in Joomla and there are some features that used to make K2 special is available in Joomla core itself. Knowing that creating the layout in Joomla 3 is the same as creating sub-templates in K2 makes a big difference in my decision whether to use K2 or not. I might in the end stay with Joomla core articles itself since it also supports advanced tagging system now – Neel May 26 '14 at 07:50
  • 1
    Yes you can create the layout you want using core alternate layouts alternative menu layouts. Complete layout overrides have been in place since 1.5 but alternate layouts (where you can have more than one option) have been present since 1.6. This means as you said that in your html folder of the template you create your version, both the layout files AND the xml with new names so like mynewlayout.php, mynewlayout_items.php etc plus mynewlayout.xml. Of course you would also be adding css to your template if needed, that's easy, adding new files and recompiling your css is just a few clicks. – Elin May 26 '14 at 08:46
  • Thank you @Elin In that case the article I read on K2 about the K2's sub-templating system being more powerful and flexible than Joomla's is not valid anymore with the current Joomla 3.3 version, is that right? So this would mean K2's custom sub-template is no different from Joomla's custom Alternative Layouts for Joomla articles isint it? – Neel May 26 '14 at 14:16
  • I don't know enough K2 to say, but I think you should be able to do what you want with the core, and that is good in a lot of ways. If you are doing a big newspaper site or have some very complex needs you might want a CCK but whether K2 is what you need (there are a lot of options) I can't really say because it depends on your situation. – Elin May 26 '14 at 17:36
  • Thank you @Elin and Shaz. Your answers have cleared a lot for me. If one of you can add this as an answer, I can mark this question as answered. Cheers and thanks again. :) – Neel May 26 '14 at 18:21

1 Answers1

1

There is a big difference in Joomla core Alternative-Layouts and K2's approach. Hard to explain in theory...

Joomla:

The core feature offers two choices: Either create Alt-Layouts and assign them to each Category and (each!) Article in Backend. Or with a new, alternative MenuItem. The latter is achieved through an additional XML file with same name and location. As long as you work with Categories and Listings, the result is quite similar. But it is different when it comes to the Article Fullview: You won't get an alternative layout for full view automatically! You have to assign the layout in backend or use 1 global setting from the article options. The latter will only apply to articles that have no respective Alt-MenuItem. This can result in a "chicken-egg-situation". AFAIK, frontend submission requires an alternative MenuItem for each edit-form. You can't get an alternative full-view layout when you click on a blog/list item "easily". The links from your category items still lead to the "default" without extra work. In my experience, full-view layouts are displayed in the following setups only:

  • Alt.MenuItem (XML) for Category and Article. A MenuItem for each article has to exist, to automatically pickup your alt.Layout.
  • Alt.Layout assigned to each Article. (manual work)
  • Alt.Layout set for Category (no XML). Only 1 global setting in Article's manager options.

K2:

The layout folder structure is simpler. All layout files live in the same folder, you just rename that container folder. e.g. products. The inner files keep their default names. This results in an easier and automated "workflow". A layout is assigned to a category and/or its sub-categories. Article full-views pick up their layout automatically, due to the file/folder structure. There is no difference between frontend/backend. No manual assignment on article edit is needed. Nor single K2 items in the menu. (not to mention, that you get extra fields per category)

Hope this helps.

pepperstreet
  • 66
  • 1
  • 6