irislines web design
irislines web design

Alternative layout overrides in Joomla! 1.6

Two years ago I blogged about a solution to have different “read-more” links for different sections of a website.

With Joomla! 1.6 it would be possible to have two variations of the php file that generates the blog,  one that would include the words “read-more” and one that wouldn’t.   Since this affects the display in the blog “page”, not the individual articles, this layout alternative would actually need to be an alternative menu item type.

Here’s how you would do it:

1.  Locate the php files that create the blog layout and blog layout menu item type:

     components/com_content/views/category/tmpl/blog.php
     components/com_content/views/category/tmpl/blog_items.php
     components/com_content/views/category/tmpl/blog.xml

2.  Make a copy of those three files and place them in your template’s html folder and rename them!  I’ve used blogworm.php…etc.  for blog without read more

     templates/your-template/html/com_content/category/blogworm.php
     templates/your-template/html/com_content/category/blogworm_items.php
     templates/your-template/html/com_content/category/blogworm.xml

3.  The change we’re talking about only requires a change in the blogworm_items.php file.

     at  line 155  (or nearby)  find:
     echo JText::_(‘COM_CONTENT_READ_MORE’);      and delete that.

4.  Open blogworm.xml and make changes to line 3:  you add a reference to your template at the beginning and change BLOG to BLOGWORM at the end of each of these strings:

 

      So what’s all that shouting about?   Those are strings that will be added to a language file, where you will provide a translation.

5.  Use TextEdit or NotePad to open your templates lanugage file — the .sys.ini one — or grab a copy from beez_20 as a starting point.  This file provides extra info about your template positions that shows up in the template manager.  It also provides info to display in the menu item manager.

     templates/beez_20/language/en-GB/en-GB.tpl_beez_20.sys.ini

     ADD to this file: 

TPL_BEEZ_20_COM_CONTENT_CATEGORY_VIEW_BLOGWORM_TITLE=”Beez 20  Blog without the words Read More”

TPL_BEEZ_20_COM_CONTENT_CATEGORY_VIEW_BLOGWORM_OPTION=”Beez 20 Blog without the words Read More”

TPL_BEEZ_20_COM_CONTENT_CATEGORY_VIEW_BLOGWORM_DESC=”Provides read more links without the words Read More – for use in photo gallery”

6.  Create a menu item to display this category as a blog with out the words “read more” in the read more links — choose your new menu item type from the menu item types list.

 

 

 

Tags: , , ,

IrisLines LLC
101 Washington Street
Brattleboro, VT 05301

802 257 7391

info@irislines.com