How to get the name of the active layout for the component used

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
snor512
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Sat May 14, 2016 6:22 pm

How to get the name of the active layout for the component used

Post by snor512 » Sat Jun 11, 2016 8:56 pm

I would like to get the name of the active layout for the category content component what is being used at this moment in my joomla through one override one_template/html/com_content/category/blog2.php' and 'one_template_name/html/layouts/joomla/content/category_default_without_title_categ.php' and 'one_template/html/layouts/joomla/content/category_default.php'

The code inside 'category_default.php':

Code: Select all

<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

JHtml::_('behavior.caption');
?>
<div class="category-list<?php echo $this->pageclass_sfx;?>">

<?php
$this->subtemplatename = 'articles';
echo JLayoutHelper::render('joomla.content.category_default_without_title_categ', $this);
?>
</div>
</div>
Depending of the name of the current used layout file (ej, blog2.php or blog.php) what is being used I would like choose and load one (category_default_without_title_categ.php) or other (category_default.php) by a conditional instruction like:

Code: Select all

if(){
echo JLayoutHelper::render('joomla.content.category_default_without_title_categ', $this);
}
else{
echo JLayoutHelper::render('joomla.content.category_default', $this);
}
You do not have the required permissions to view the files attached to this post.
Last edited by imanickam on Sun Jun 12, 2016 1:32 am, edited 1 time in total.
Reason: Moved the topic from the forum General Questions/New to Joomla! 3.x to the forum Joomla! 3.x Coding

snor512
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Sat May 14, 2016 6:22 pm

Re: How to get the name of the active layout for the component used

Post by snor512 » Tue Jun 14, 2016 12:44 pm

I got to solve this via:

1. setting the parametters in the Administrator Web Side -> Menus -> Edit Item -> 'Portada' (Inicio) -> Details, Category and Options Tabs

2. Content ->Articles-> Edit Category -> 'Portada' -> Options Tab -> Alternative Layout (List)


Locked

Return to “Joomla! 3.x Coding”