An approach would be to create a template override (aka HTML output override) combined with language sting override.
The following documents would be of help in understanding the output override technique. Even though some of the documents may not be for the latest version of Joomla, the concept is equally good for all versions of Joomla.
https://docs.joomla.org/Understanding_Output_Overrides
https://docs.joomla.org/J4.x:Template_Overrides
The following document would be of help in understanding the Language Override.
https://docs.joomla.org/J4.x:Language_Overrides
https://docs.joomla.org/Help4.x:Languages:_Overrides
https://docs.joomla.org/Help4.x:Languag ... verride/en
As you are referring to the Blog layout, the file to override would be blog.php that is located in the directory \components\com_content\tmpl\category.
The line of code to modify would be as shown below:
Original code:Modified code:
With this modification, the system would be looking for a language string with the language constant COM_CONTENT_NO_ARTICLES followed by an underscore and the category id. That is COM_CONTENT_NO_ARTICLES_X where X is the category id.
For example, if the category id is 12, then the language string that the system would be looking for COM_CONTENT_NO_ARTICLES_12
With this approach, you could create a unique new language string for a category and have its value reflect the appropriate informational message that is relevant to that category.
The following documents would be of help in understanding the output override technique. Even though some of the documents may not be for the latest version of Joomla, the concept is equally good for all versions of Joomla.
https://docs.joomla.org/Understanding_Output_Overrides
https://docs.joomla.org/J4.x:Template_Overrides
The following document would be of help in understanding the Language Override.
https://docs.joomla.org/J4.x:Language_Overrides
https://docs.joomla.org/Help4.x:Languages:_Overrides
https://docs.joomla.org/Help4.x:Languag ... verride/en
As you are referring to the Blog layout, the file to override would be blog.php that is located in the directory \components\com_content\tmpl\category.
The line of code to modify would be as shown below:
Original code:
Code:
<?php echo Text::_('COM_CONTENT_NO_ARTICLES'); ?>
Code:
<?php echo Text::_('COM_CONTENT_NO_ARTICLES'.'_'.$this->category->id); ?>
With this modification, the system would be looking for a language string with the language constant COM_CONTENT_NO_ARTICLES followed by an underscore and the category id. That is COM_CONTENT_NO_ARTICLES_X where X is the category id.
For example, if the category id is 12, then the language string that the system would be looking for COM_CONTENT_NO_ARTICLES_12
With this approach, you could create a unique new language string for a category and have its value reflect the appropriate informational message that is relevant to that category.
Statistics: Posted by imanickam — Wed Aug 21, 2024 5:50 am