? Pending

User tests: Successful: Unsuccessful:

avatar bembelimen
bembelimen
25 Feb 2017

Summary of Changes

At the moment it's very complicated to define a default sublayout which can be loaded by different layouts. For example let's assume you have a calendar view with three layouts: month, week, year and the following structure

|- views
    |- calendar
        |- tmpl
            |- month.php
            |- week.php
            |- year.php
            |- year_myfunnystuff.php

I can call the three layouts with the parameter &view=calendar&layout=week/month/year. But now if I want to load "myfunnystuff" in all other layouts I have to do the following:
year: $this->loadTemplate('myfunnystuff');
month: $this->setLayout('year');$this->loadTemplate('myfunnystuff');$this->setLayout('month');
week: $this->setLayout('year');$this->loadTemplate('myfunnystuff');$this->setLayout('week');

After this patch it's much more easier:
year: $this->loadTemplate('myfunnystuff');
month: $this->loadTemplate('myfunnystuff', 'year');
week: $this->loadTemplate('myfunnystuff', 'year');

Testing Instructions

try to create structures like above and load it.

avatar bembelimen bembelimen - open - 25 Feb 2017
avatar bembelimen bembelimen - change - 25 Feb 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 25 Feb 2017
Category Libraries
avatar rdeutz rdeutz - change - 27 May 2017
Labels Added: ?
f525bf1 30 Apr 2018 avatar Quy c/s
avatar Bakual
Bakual - comment - 30 Apr 2018

If you name your sublayout default_myfunnystuff.php, you can load it using `$this->loadTemplate('myfunnystuff') from any layout. The function has a fallback to "default_" prefix in case a layout specifc file (eg year_myfunnystuff.php) doesn't exist.

avatar brianteeman
brianteeman - comment - 8 May 2018

So there is no need for this PR and it can be closed?

avatar laoneo
laoneo - comment - 9 May 2018

That's actually very useful and shouldn't be closed.

@Bakual this pr solves a different use case. The issue is when you want to use a sublayout of a different layout, then you need to do the hack @bembelimen has described in the description or you need to copy it. You can even go further and load one template in another with this patch.

avatar Bakual
Bakual - comment - 9 May 2018

The PR description starts with:

At the moment it's very complicated to define a default sublayout which can be loaded by different layouts.

Just name the default sublaout default_foo and it will work. That's exactly the usecase for that feature that already exists.

The issue is when you want to use a sublayout of a different layout

That would be a different usecase, and honestly I'd say it's a hack if you call a sublayout from another layout. Just name that sublayout with a prefix "default_" if you're going to use it in multiple layouts.

avatar bembelimen
bembelimen - comment - 23 Jul 2018

Closed in favor of: #21228

avatar bembelimen bembelimen - change - 23 Jul 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-07-23 11:52:24
Closed_By bembelimen
avatar bembelimen bembelimen - close - 23 Jul 2018
avatar fatmaakay fatmaakay - test_item - 23 Jul 2018 - Tested successfully
avatar fatmaakay
fatmaakay - comment - 23 Jul 2018

I have tested this item successfully on 3a11908


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14251.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 23 Jul 2018

@fatmaakay thanks for testing but this PR is closed.

avatar bembelimen
bembelimen - comment - 23 Jul 2018

@fatmaakay could you please test here: #21228

Add a Comment

Login with GitHub to post a comment