How to assign different Joomla template styles to a category and it contains articles? - joomla

How to assign different Joomla template styles to a category and it contains articles, meaning that articles and categories use different style templates and layouts。
just like:
Category A contains many A articles. This category uses the website template protostar, but the article I want to use beez3, is there a way to make a judgment to change the layout? Or directly assign different style templates?

Joomla tends to be menu driven so you can create a Category Blog or Single Article menu option (page) or similar and then assign the required template style to each page in the template options.
Page classes can also be specified for menu options (pages) so that you can apply custom CSS to particular pages.

Related

Processwire Holder/Page implementation

How do you implement a holder/page pattern in Processwire. The idea is simple. One page type manages the list view, and usually contains very little native content. The primary function of this page is to provide a list of its child pages, providing a brief summary for each one, along with a link to its detail view. A second page type will represent the detail view for any given child page, which will typically have a custom template and content fields that make up its identity. Think of it think like a news listings, image galleries, even a Twitter timeline.
I can give examples for two different methods from a recent site I built with Processwire.
First is NEWS section:
I have a page called News and it's template is news-listing. Under News, I have news pages and their template is news-detail. news-listing template only accepts news-detail and news-listing for child pages. I allowed news-listing under news-listing if client needs to create sub listing pages under news.
News-listing template basically gets the news with
<?php $news = $page->children('template=news-detail'); ?>
Second is Products section
Site has different section for purposes. Like WOMENS, MENS, KIDS etc. The products are not shared among those main separation. I have a structure like below
MAIN SEPARATION
Products (products are listed under)
Categories (categories are listed under)
On product details page you can select multiple categories. On categories page products are listed like this. And on main separation page I have categories listed. Each of these page type has their own templates.
$products = $page->rootParent->find("template=product-detail,category={$page->id}");
Hope it helps
Just create pages under parent page then iterate on children pages. Processwire is slow though, better use Silverstripe it's more responsive.

Confused between Joomla Alternative Layout and Templating with K2

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.
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.

Magento query language in a cms page

I want to display a text only for a specific language in a cms page which contains a placeholder. So I cannot use the way with the translate.csv. (see http://jagdeepbanga.com/blog/magento_how_add_translation_ability_into_cms_page_or_static_block.html) It would just display the placeholder in plane text. And since it's a CMS-Page from an plugin I can't change to a specific store view.
Is it possible to do an if query in the cms page like displayed below? (Or sort of) It should work in the cms page without the need to use or editing a phtml template.
if (store view = norsk)
{
<p>bla...</p>
{{some placeholder}}
};
I made an extension with this topic, feel free to use it or modify it!
https://github.com/miguelbalparda/MB_Translate
You can use a CMS block with a different version for each store view, and include it in your CMS page with {{block type="cms/block" block_id="your_block_id"}}

Make a new page in joomla 2.5

i have done the home page with 8 custom html module . Now i have to make new pages like contact us, about, services ect. but it different from the home page. i need to use only two module other are not useful for other pages.
I am new in joomla would like to how could i make new pages in joomla.
Create a new page in the article manager and a menu item to that page. Then go into the module manager and enable those two modules for that menu item. You'll now have the new page and those 2 modules will appear.
Depending on what template you are using they may need to be in a different "position", e.g, below the content, to the side, etc. In that case use the duplicate function in the module manager to make a clone of those modules and place in the appropriate positions.
Note: If you want the modules to appear in the actual content area you can use the loadposition plugin, e.g. if you create a blank article you can then enter {loadposition mynewmoduleposition} to place the module in the page. Just remember to select that page in the module manager and put set the module to that position.
Just a note that joomla is "menu related" site where pages mean menu itemID, when you say "pages" i believe you have experience in wordpress...
All "pages" in a Joomla website are created with the single index.php file in the template you are using. In order to alter what displays from one page to another there are a few things to consider.
First, Joomla uses menu items to determine what a page is. When you create a menu item, it is assigned an itemID. In the case of menu items that have child items (an article within a category menu), then the child items inherit the parent itemID. You can then select to display modules on that menu item. In the module parameters there are options to display a module on all menu items, no menu items, selected menu items, and exclude menu items. You would change these selections to fit what you want displayed.
The second thing to consider is the template itself. It sounds like you have created a custom template so you will likely need to alter that. The index.php file should contain all of the possible module positions that you would may want to use. In order to hide the positions that are not being used on a particular page, you need to make those positions collapsible. You do this by not displaying any module position that is not populated on a particular page using this code:
<?php if ($this->countModules('top')) : ?><jdoc:include type="modules" name="top" style="xhtml" /><?php endif; ?>
You would want to use similar code for each module position on the page. This allows you to have a sidebar position that is not displayed on the home page, but is displayed on other interior pages that include a module in that position.
Ideally, if you plan the template properly, you will have many module positions that will allow you to add content in many different positions without having to touch the template once it is coded.

Joomla conditional pages and menus

I'm trying to make a "Chapter selector" for my organization's website. I want to be able to select, say, the "Bay Area chapter" and have the site display articles and events for the Bay Area chapter (while keeping the chapter-independent parts of the site the same). How do I accomplish this?
I'd need a little more detail but here are some of the things to consider -
I am a fan of K2 for being able to nest categories, but you can at least categorize all of your Chapter information in to separate categories within a single section in the Joomla content manager.
For each Category you will need a menu item - Articles > Category > Category blog Layout
In the module manager you will need corresponding modules that display category related information. Be sure to associate the modules to the correct menu items in the module's Menu Assignment area.
I'd do the chapter selector as a menu. Create a menu to contain your chapters and then publish a module for that menu which allows you to pick your items with that chapter.

Resources