Your own template for the Joomla category. Joomla Templating - Alternative Layout and Template Overriding Category Blog Template


Situations often arise when you need different categories in Joomla! output using individual templates. For example, the news category is displayed with its own template, and the article category should be displayed with its own template, which is very different from the Joomla news display template. Here is a simple way to do this at the standard com_content output template level, without affecting the Joomla core.

Having looked at the structure of the standard com_content component in Joomla, let's copy the category template output files into our Joomla template, if they are not already there. Consider the category blog output template:

(root)\templates\(TEMPLATE)\html\com_content\category\blog.php – initial template

(root)\templates\(TEMPLATE)\html\com_content\category\blog_item.php – material template

(root)\templates\(TEMPLATE)\html\com_content\category\blog_links.php – template for links to the following materials

The blog.php output template will load first, which in turn uses the other two templates. To solve the problem, you do not need to touch the Joomla core files, but only templates will be used.

Since blog.php will be loaded first, manipulations must be carried out with it accordingly. You can add the necessary condition to check the Joomla category. After checking that direct access is prohibited, add:

items->catid === $categories[$i]) ( $this->_layout = "myblog"; $this->display(); $check = true; break; ) ) // If the condition does not match, display the usual template if (!isset($check)) : $cparams =& JComponentHelper::getParams("com_media"); ?>

And at the end of the file we close the condition:

Let's look at the code a little:

To a variable $categories we ask ID categories that need to be displayed as a separate template, separated by commas. Then, accordingly, we arrange the whole thing into an array and select the first element in order to determine the output category. Then we compare this category with those specified in the variable $categories and if there is a match, we set our template and display it. If no matches are found, then the variable $check is not installed and the usual blog.php template is displayed.

All that remains to be done is to create our template files in the same directory:

(root)\templates\(TEMPLATE)\html\com_content\category\myblog.php – initial template

(root)\templates\(TEMPLATE)\html\com_content\category\myblog_item.php – material template

(root)\templates\(TEMPLATE)\html\com_content\category\myblog_links.php – template for links to the following materials

This way you can control the output templates for different categories without affecting the Joomla core.

IN WordPress this is implemented very simply: just create a copy of the template category.php and add to it a slug (English system name of the rubric) from the required rubric. For example: category-news.php will be used when displaying category posts with a slug news.

If previously almost every girl kept a diary of personal experiences in her desk, now the entire Internet community is interested in various thematic blogs.

Joomla blog templates are the perfect way created to manage your content. Today, almost every famous person has their own blog. It is very interesting to learn news about the life of your favorite singer or artist, but this does not mean that it is not at all interesting to look through the pages of ordinary people. After all, it is always productive to read useful tips, interesting experiments, as well as the latest news from the fashion industry.

Now there are no difficulties with organizing personal space on the Internet. You can simply scroll through the news and purchase your favorite blog categories for joomla.

Blog templates that are published and accessible to everyone are ideal both for creating an interesting personal portfolio and for a magazine dedicated to fashion trends. There are even special developments designed for music lovers who decided to start their own blog to unite like-minded people. In this case, you will be able to choose both a design and a directly informative series with the main emphasis on the presentation of various video clips and, accordingly, audio tracks. If you wish, you can even create a personal social network without any problems, which will be intended for especially sociable fans of various musical genres.

Have you decided to create your blog on joomla and combine it with online sales? Then you need to pay attention to joomla 3 blog templates, which provide the ability to implement online sales.

Each of the presented Joomla templates is distinguished by its beauty, style, and at the same time you can easily customize it for your own needs.

Hello, dear readers of the blog site. Today we will continue, which we have already raised once before, and also learned. Today we will try to look at various options for displaying articles on website pages using various menu items.

The menu is one of the fundamental parts and usually acts as navigation elements. But in addition to navigation, they determine what exactly will be displayed on the dynamic page after following a link. In fact, they determine what will be displayed on a particular page.

What are they for and how to work with Joomla menu items

This is not so easy to understand, especially for those users who have dealt with static sites in which the role of the menu was reduced only to providing navigation. In general, the issue of organizing content and methods of displaying content is one of the most difficult for beginner Joomlovians.

At first, it is very difficult to grasp the entire relationship between the menu, its items, the content of web pages and the modules in which they are displayed. But let's talk about everything in order. Firstly, they, as in any other website, can be located either horizontally (most often in the upper part of the window, but it is also possible to create a lower one) or vertically (either in the left or right column of the template).

What’s noteworthy is that the navigation menu item in Joomla can lead either to a page with one single article or to a blog or a list of materials contained in a category or section. Moreover, the same publication can be accessed through different links from the menu.

Some links will open them all alone on a web page, while others will display them as a list or as a blog of the category or section to which it belongs. You probably still don’t quite understand what we’re talking about, but I hope that this understanding will come when you finish reading this guide.

So, you can see all this wealth in one place - in the menu manager. It can be accessed from the admin panel by selecting “All menu” - “Menu” from its top line. For each of them, you can create items that will form web pages with one or another.

Their appearance is set from the settings of these same menu items. This is very important to understand, because knowing where to look for certain settings will make your task much easier. , as well as setting up modules for them.

Having entered the menu manager, you can click on the icon in the column opposite the one you need, which will open a list of all the items that are already there. This page can also be accessed by simply selecting in the admin panel from its top line “All menu” - “Name of what you need”:

As a result, a window with a list will open:

Creating a Menu Item

At the top of it you will see buttons, among them there will be a “Create” button, clicking on which will open the wizard for creating a new navigation element:

In this window you will see a tree structure of the types of menu links that you can create in Joomla. This tree contains nested elements that will open after clicking on the selected parent branch. Everything is quite simple and clear.

It serves so that we can select the option of presenting the page to which we will go after clicking on the created menu link. In other words, you will have to choose one of the Joomla page templates. Different templates allow you to combine one or more articles based on the sections and categories to which they belong.

Please note that in the tree above there are quite a lot of options and they are divided by type of component (this is), on the basis of which the content will be displayed on the site. We are primarily interested in options that suggest creating a Content component built into the engine by default, which is responsible for working with materials.

But besides the main component for working with articles, there are others, which, in turn, will also add their own options to this tree, allowing you to link to web pages with content generated by our Content.

But for now we will focus on considering the output of materials, and everything else will be considered as best we can. So, a menu element in Joomla can link to three main types of pages: with a single article, an entire category or a section.

In addition, a menu element can indicate either an individual component or a category of this component. For example, you can create a link that leads both to a page with a list of all the categories of the gallery you created, and to a page with the content (photos) of just one.

This mess might look like this:

At the same time, the following options were selected in the tree from those that were added after installing the Phoca Gallery component:

The main task when creating a website on Joomla is to correctly organize the information content (content, content). I mean the structure of sections and categories, both for articles and, for example, for the photo gallery component. Well, there are quite a lot of methods for displaying well-structured content.

True, it is often the variety of withdrawal methods that causes difficulties for novice users. But I hope that by the end of reading this publication, the confusion caused by the confusing system will decrease a little, and clarity will appear on at least some issues.

If you want to achieve the most convenient navigation, then you should start with the correct formation of sections and categories and the distribution of available articles between them. And to create on this basis an extensive system of menus and their elements for convenient and understandable output for users will be a matter of technology.

Menu elements that allow you to display articles on the site

To display content that includes articles on your site, you will need to add new elements to the menu from the tree branch called “Materials”. Quite logical, I suppose. By clicking on this branch of the tree, you will see a list of all possible options that you can use to display materials on the web pages of your site:

There are not so many of them, but they will allow you to display article content in a wide variety of forms - from individual publications to a blog of an entire section on one page of the website.

Now we just have to understand what this or that option in this branch of the tree serves, and then figure out their settings, which allow us to display blogs or lists of articles in Joomla. Using these settings, you can set the appearance and display order of materials. But first things first.

We will consider the option of outputting one single article at the end of the publication, and there is nothing complicated or requiring attention there. And now I want to dwell in detail on two main output patterns:

  1. Blog (category or section) template – so called because the way articles are displayed in this case is reminiscent of standard blogs. In this case, a web page generated in Joomla will generally be a series of announcements (introductory parts) of articles that will end with a “More details” link. They will all belong to either one section or one category, which you choose when setting up.
  2. A standard template for a section or category list, which is essentially the same thing. A web page generated in Joomla will be a table that lists either category headings from a certain section or article headings from a certain category.

Of course, the blog template has much more flexibility than the standard one, which displays the contents of the page in a table only in the form of headings, which are links to the full versions of the articles.

The blog format of a category or section allows you to display not only the titles of articles, but also add a small announcement, which allows you to arouse additional interest among visitors to this page to continue reading and clicking on the “Read More” link.

At the same time, you can quite flexibly customize the appearance of articles. You can set how many announcements will be displayed across the entire width of the page, how many will be divided into columns, set the number of columns and determine the number of materials displayed below in the form of links.

How to create a blog in Joomla based on category articles

Let's first try to create a menu element in Joomla based on a category (or section) blog template and look at all the settings that we can change. They will be almost identical for them. Therefore, we will consider only the option based on the category template, and you can figure out the section yourself by analogy.

So, go to the Joomla admin panel, select their top line items “All menus” - “Name of what you need”. On the page that opens, click the “Create” button located at the top. In the tree that opens, click on the option “Materials” - “Category” - “List Template”. As a result of these actions, a window will open with menu item settings based on the template you selected:

In the “Title” field, as usual, enter the name for this menu element, which will be displayed on the site. The “Nickname” field should only be filled in if . Then you will need.

If you use third-party components to organize the SEF, you will not need to fill it out. I already wrote.

The “Link” field displays a hyperlink to the page generated based on this menu item. You can copy it and use it to create web links from the text of other articles on your site. In the “Show in” field, you will have to select the menu in which the item we are creating will be located.

In the “Parent Element” column, you can select a parent for the element being created, when you click on it, our nested item will be displayed in the menu. If you do not want to make it nested, you should leave the default option “Top”.

In the “Access” area, you can set which visitors will see this item. Either everyone (used most often), or only registered ones, or only Joomla administrators (the “Special” option).

In the “Open in” field, choose whether the page will be opened in the same window, or in a new window, or in a new browser tab.

Setting up a blog on Joomla

We go to the right side of the settings, where tabs with parameters responsible for presenting the web page that will be opened as a result of clicking on this link are concentrated. Let's start our consideration with the main parameters located on the tab of the same name:

In the “Category” field, you must select the one whose content will be displayed as a blog. In the “Description” column, you can hide or show the display of the description for this category, which will be displayed at the top of the blog page. The same applies to “Picture Description”.

In the “Full Width” field, you can set the number of articles (most often only their introductory parts - announcements) that will be displayed in the entire width of the web page, without breaking into columns. In the “Introduction” column you specify the number of materials that will be divided into columns, and in the “Columns” field you specify their number. They will be displayed behind those articles that are displayed in full width.

Thus, you can, for example, enter the numbers in these four fields: 1 6 2 4, as a result of which the generated blog page will look like this: one article announcement will be displayed at the very top, followed by six more announcements from this category, well, at the very bottom there will be a list of four more links.

It's clear? No? Then try experimenting with the numbers in these settings yourself and everything will become clear and understandable to you. It is currently not possible to implement in Joomla the display of articles in a category or section blog, first in columns and then across the entire width of the page. Therefore, you will have to be content with what you have.

Oh, by the way, a zero in any of these four fields except “column” will mean that none of the materials in that category will use this display feature. We have looked at the main parameters that can be changed when creating a menu item in Joomla. Now let's go to the advanced tab:

Here are the settings that are responsible for the order of articles. There are a lot of options - by date, alphabetically, in the order of display that you set in the content manager (of this category).

You will need the Order field if you are creating a menu item for a section that contains more than one category. In this case, you can choose the method you want to sort the categories in the section, according to which a list of them will be displayed on the page, generated on the basis of the section’s blog template.

The “Sorting” field determines the order of the articles themselves when they are displayed. By the way, when creating a menu item codenamed “Section Blog Template”, you can sort all articles without taking into account their belonging to a particular category, but to do this you need to select the “Default” option in the previous “Order” field.

If you select the “Display Order” option, then articles from the Joomla category you have selected will be displayed on the page in the order that you set in the content manager, setting a filter only for it.

There are two ways to sort articles in the content manager that belong to the category you need. You can place the numbers you need in the “Sorting” column and click on the diskette located next to the name of this column. You can also use the green arrows in the same column, but with a large number of articles this will probably be inconvenient.

In the “Pagination” column and the next few columns of advanced menu item settings based on a category or section blog template, you can hide and show pagination. Let’s say that if there are more materials in the displayed category than you specified in the settings described above, then Joomla will add numbering (pagination) at the bottom of the generated web page with a blog, unless you disable this in the “Paging” field.

Do not forget that articles intended to be displayed as part of a blog in Joomla must be prepared accordingly, namely, you will need to open it in a visual editor for editing, place the mouse cursor after several paragraphs of text and click on the “ More details", located at the bottom of the editor window.

As a result, at the cursor position, a line will appear separating the text of the announcement. Only the announcement located above this line will be displayed on the blog.

Displaying a separate material, a list of categories or articles

Let's now go over the settings you can set when creating or editing a menu item based on a standard section template. First, go to the admin panel, select from the top line “All menu” - “Name of what you need”. In the window that opens, click the “Create” button located at the top.

In the tree of items that you can create that opens, click on the option “Materials” - “Category” - “Standard section template”. As a result of these actions, a window with settings will open.

What is noteworthy is that its left side will look exactly the same as in the one we examined earlier. The main difference lies in the main parameters:

In the “Section” field, you will have to select a section, the list of categories of which will be displayed when you click on this link in the menu. By the way, a visitor, when viewing a list of categories, will be able to view the list of materials in each of them by simply clicking on its name with the mouse. The purpose of the “Description” and “Image” fields is similar to that discussed above.

It will be easier for you to see the purpose of the remaining fields in action than to read about it. All other settings are no different from those discussed above.

Let's try to create a menu item in Joomla based on a category list template and see how the settings differ:

In the settings below, you can set the number of articles displayed in the list, as well as allow or disable the display of list column headings, creation date (you can set your own format for it) and a filter that will allow you to sort materials by headings, authors, or by hits (number of views of the material by visitors).

Well, finally, I’ll say a few words about creating a menu item in Joomla based on a standard material template. Everything is very simple here, in the main parameters you only have the ability to select the article you need from the material manager, which will open when you click on the menu item link.

It is possible that this bourgeois vision of successful blog promotion will be useful to you (the author of the most popular blog on SEO in the bourgeoisie speaks):

Good luck to you! See you soon on the pages of the blog site

You might be interested

Creation and display of articles (content) in Joomla using sections and categories, a blog on Joomla and a Read more button.
Contacts for the site and feedback form using the built-in Joomla component
What is Joomla
Modules for displaying a list of sections in Joomla, random and latest news, similar materials, arbitrary photos and Html code
Menu in Joomla - adding a nested or drop-down menu, as well as creating and configuring a module for displaying it on the site
Modules in Joomla - viewing position, setting and output, as well as assigning class suffixes
Organizing content in Joomla - deleting and creating articles in the admin panel, as well as setting parameters for all materials
K2 component for creating blogs, catalogs and portals on Joomla - features, installation and Russification
Joomla admin - a complete manual on all the settings of the Joomla admin panel in details and pictures

In this article I would like to touch on a very commonly used type of menu - category blog template. In fact, this item allows you to display the contents of a category on the page. The only nuance is the word " blog". In fact, this is just a type of output. For example, on my main page (and in sections) an almost similar option is implemented. However, it is better to see once than to hear a hundred times, so it is better to add a category blog template to the menu and see the result. And we will look at how to add this type of menu in this article.

When creating a new menu item, you need to select the type - " Category Blog Template":

But as for " Options-General" And " Options-Advanced" they need to be reviewed here because they are different from other types of menus.

Let's start with the group " Options-General":

  • Category. In this drop-down list you need to select the category that you want to display.
  • Description. If you wrote a description when creating a category, then here you can either show or hide it.
  • Description picture. If you specified a picture for a category, then you can display it here.
  • Full width. This parameter specifies how much material will be displayed across the full width of the content. Here it is better to look at the result, and you will immediately understand what this option does.
  • Introduction. The number of articles that the user will see with a short description.
  • Columns. Number of blog columns.
  • Links. The number of simple links to articles that appear immediately after all materials are displayed in full width and introductory.

In general, it is better not to describe these parameters, but to look at them right away, and then you will immediately understand. The only thing is that you need to create at least several articles to really see the difference.

And now let's look at " Options-Advanced":

  • Order of categories. This is sorting items into categories. " Title in alphabetical order" - this is sorting alphabetically, " Title vs alphabet", on the contrary, sorting against the alphabet. A " Display order" means that the elements will be sorted according to the order you specified.
  • Sorting. Here you need to select the sorting option you want from the drop-down list. Just in case, hits- this is the number of views of the article, because this word is often found in different versions of localization, and not everyone knows it.
  • Order for multi-columns. Organizing category materials by columns. This only applies to those types of blogs where 2 and more columns.
  • Page splitting. Show or hide pagination.
  • Page split results. If the previous option is enabled, then here you can display the result of the split. For example, " 1-2 of 2".
  • Show feed link. You can enable RSS feed for this category, then people can subscribe to it and receive notifications about updates.

From my own experience, I will say that all these settings often do not need to be changed, so if something remains unclear, then just look at them in practice. Although, most likely, this will not be necessary.







2024 gtavrl.ru.