Layout override doesn't work

Phoca Gallery - image gallery extension
jedivader
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Jul 2013, 21:47

Layout override doesn't work

Post by jedivader »

Layout override doesn't work with Phoca Gallery (I'm currently using version 3.2.6).

In order to make it work, I had to add the following code:

Code: Select all

		$active = JFactory::getApplication()->getMenu()->getActive();
		if (isset($active->query['layout'])) {
			$this->setLayout($active->query['layout']);
		} 
in function display in components\com_phocagallery\views\category\view.html.php

Same thing has to be done for every view you want a layout override for.

This should be implemented by default.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Layout override doesn't work

Post by Jan »

Hi, for now this is planned, the standard MVC override feature does work and the additional features are planned - but first the extensions needs to be overwritten for next Joomla! version.

Jan
If you find Phoca extensions useful, please support the project
ataman79
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 25 Feb 2014, 12:02

Re: Layout override doesn't work

Post by ataman79 »

Hi I am using Phoca Gallery 3.2.7

I want to override com_phocagallery/views/category/view.html.php - (some changes in displaying the Page title)

What should I do to make the override work

I create in my template/html folder the new ones com_phocagallery/views/category/view.html.php

But the verride didn't work. Should I use the code from above

Code: Select all

 $active = JFactory::getApplication()->getMenu()->getActive();
      if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
      }
And if yes where should I put it ?

Thank you in advance
jedivader
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Jul 2013, 21:47

Re: Layout override doesn't work

Post by jedivader »

ataman79 wrote:Hi I am using Phoca Gallery 3.2.7

I want to override com_phocagallery/views/category/view.html.php - (some changes in displaying the Page title)

What should I do to make the override work

I create in my template/html folder the new ones com_phocagallery/views/category/view.html.php

But the verride didn't work. Should I use the code from above

Code: Select all

 $active = JFactory::getApplication()->getMenu()->getActive();
      if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
      }
And if yes where should I put it ?

Thank you in advance
You should put it where I said I put it in my original post:
jedivader wrote:in function display in components\com_phocagallery\views\category\view.html.php
In my code it's right before this line:

Code: Select all

$neededAccessLevels	= PhocaGalleryAccess::getNeededAccessLevels();
ataman79
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 25 Feb 2014, 12:02

Re: Layout override doesn't work

Post by ataman79 »

Thanks for the answer,
ok I put it in components\com_phocagallery\views\category\view.html.php

after that in my template folder I create the same folder structure template/mytemplate/html/com_phocagallery/views/category and copy the file view.html.php

and made my changes BUT they are not applied. :(

Is my folder structure for overriding is ok , or I made a mistake ?
jedivader
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 14 Jul 2013, 21:47

Re: Layout override doesn't work

Post by jedivader »

ataman79 wrote:Thanks for the answer,
ok I put it in components\com_phocagallery\views\category\view.html.php

after that in my template folder I create the same folder structure template/mytemplate/html/com_phocagallery/views/category and copy the file view.html.php

and made my changes BUT they are not applied. :(

Is my folder structure for overriding is ok , or I made a mistake ?
It's wrong, it should be like this:

templates\mytemplate\html\com_phocagallery\category

and you should be overriding the php files from components\com_phocagallery\views\category\tmpl, you can't override view.html.php
ataman79
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 25 Feb 2014, 12:02

Re: Layout override doesn't work

Post by ataman79 »

I see, thank you

I wanted to edit view.html.php , because there I found the code I wanted to change , connected to the browser site name order ... $title = JText::sprintf('JPAGETITLE', $title, htmlspecialchars_decode($app->getCfg('sitename')));
}

But finally I decided not to hard code the view.html.php, I will change the browser sitename using the Joomla menu

Thanks again
Post Reply