How to display sidebar blocks on search results and tag pages

Jopho

Joined: 2010-11-27
Posts: 14
Posted: Tue, 2012-02-28 01:05

Hi,
This isn't a bug as such, but the sidebar section of the page for tag and search results is always blank, using GD theme. Only the Basket side-block shows up when I change to Wind theme, and I'd like to know what code to add or change to enable display of existing sidebar blocks on dynamic pages such as tag or seach results.

I'm not looking to generate extra information - just to enable display of some sidebars which appear on other pages.

Possible files I've looked at, but can't work out how to re-code include - modules/*/helpers/*_block.php and in theme/views/ folder the block.html.php , dynamic.html.php and sidebar.html.php . Has anyone tried to change this on their gallery3 ? Any ideas appreciated, thanks.

 
CeliaD

Joined: 2009-01-03
Posts: 47
Posted: Tue, 2012-02-28 07:59

See this post:
http://gallery.menalto.com/node/90636?page=3
----------------------------------------------------------------
For those who want to fix this on their own, the error is in views/basket-side-bar.html.php on line 9:

Quote:
if ($item->is_photo() && product::isForSale($theme->item()->id)){

This needs to be changed to:

Quote:
if ($item && $item->is_photo() && product::isForSale($theme->item()->id)){

Otherwise is_photo() will be called without an object, which crashes Gallery and generates a nasty 500 response and a broken page.

--
http://inposure.se/
--------------------------------------------------------------

 
Jopho

Joined: 2010-11-27
Posts: 14
Posted: Tue, 2012-02-28 13:13

Tried your suggestion for basket-side-bar.html.php .There's no change to my Greydragon theme - however when switched to original Wind theme the RSS Sidebar block now shows up on Tag and Search result pages - that's a good start.

This is a puzzle! - My guess is several inter-related files may need ammending. Just a matter of finding which files.

http://www.graphicscapes.com.au/gallery3/index.php/search?q=red

 
Jopho

Joined: 2010-11-27
Posts: 14
Posted: Wed, 2012-02-29 03:37

Have solved my puzzle ! - As I'm using an older modified version (sorry - forgot to mention that in my original post) of GD theme, I needed to specify page sub-types for tag and search pages in themes/greydragon/views/sidebar.html.php . Alternatively I imported this file from an updated version of GD theme, which also works fine.

Cheers

 
cndxt

Joined: 2012-04-05
Posts: 5
Posted: Mon, 2012-04-09 12:21

Hello CeliaD,

Good analysis, but this is not the only problem...

$item is the return value of $theme->item() right?

item() is always available, but you cannot call it in another instance like $item. I don't know exactly, i guess there is some mechanism to prevent creating further instances of the original class.

Then, is_photo() is only available when it's an original gallery core output of Albums, Thumbs, Fotos and the like... But not in Module output like Tag Albums, All Tags etc... So this will result in 'call to uundefined class method' when trying to call is_photo on such a Module-Page.

You can Test this with get_class_methods.

if ($item) isnt a good condition, you better use if (class_method_exists($theme->item(), 'is_photo')) and put something into this condition

See here for more details

http://gallery.menalto.com/node/104319#comment-389799

Greetings NIck