I've found a workaround, that works quite well. For unfortunatly the solution of benny_71 (change of view.html.html) is very nice, it would not work:-( This is why I did the following:
See here the "overriding" template's default.php
(JPATH_BASE."/templates/templateName/html/com_member/category/default.php)
It is not really overriding the core-default.php
It ist more a "controller" or switch,
that switches between the template's alternative layout and the core default.
Thus, there is no need to touch the core default.php or the view.html.php or to really override it.
and you can use as many alternative layouts you want.
JPATH_BASE."/templates/templateName/html/com_member/category/default.php :
Code: Select all
<?php
/**Code for:
JPATH_BASE."/templates/templateName/html/com_member/category/default.php : */
defined('_JEXEC') or die('Restricted access');
/*getting information about layout via get, see table #__menus*/
$get=JRequest::get('get');
$arr_layout=preg_split("/:/",$get['layout']); /*returns Array([0]=>templateName,[1]=>layoutName)*/
/*getting name of alternative layout and its path*/
$templateName=$arr_layout[0];
$layoutName=$arr_layout[1];
$layoutPath=JPATH_BASE."/templates/".$templateName."/html/com_member/category/".$layoutName.".php";
/*if alternative layout exists, use it; otherwise use core default;
* To avoid a loop, alternative layout may not have the name of the overriding/existing default.php */
if ("default"!=$layoutName AND file_exists($layoutPath)) require $layoutPath;
else require(JPATH_BASE.'/components/com_member/views/category/tmpl/default.php');?>
Code: Select all
<?php
if ("default"!=$layoutName AND file_exists($layoutPath)) require $layoutPath;
else require(JPATH_BASE.'/templates/'.$templateName.'/html/com_member/category/myDefault.php');
Code: Select all
<?php
if ("default"!=$layoutName AND file_exists($layoutPath)) : require $layoutPath;
else : ?>
<!--insert your default layout here; but the former solution is more beautiful -->
<?php
endif;