ZenphotoCMS Forum
getCodeBlock() not working in index.php in 1.4.0.3? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: getCodeBlock() not working in index.php in 1.4.0.3? (/thread-8564.html)



getCodeBlock() not working in index.php in 1.4.0.3? - amucklow - 2011-04-30

My theme uses album codeblock values in the next_album() loop in the index.php file. I had it working fine before I upgraded to 1.4.0.3, but now it's not working in any theme.

The values are still being stored in the database, and they are still available on album.php, so I'm thinking there's a bug limiting the scope of getCodeBlock()?

Thanks




getCodeBlock() not working in index.php in 1.4.0.3? - amucklow - 2011-04-30

Just went into template-functions.php and checked out the getCodeBlock() function. Changing this:

case 'index.php':

To this:

case 'index.php': $getcodeblock = $_zp_current_album->getCodeblock(); break;
fixes the issue I was having.




getCodeBlock() not working in index.php in 1.4.0.3? - sbillard - 2011-04-30

So, I presume that you are doing this on your index page within the next_album() loop?

Anyway, the code you have made while it works for you may well cause problems elsewhere. The getCodeblock() function is intended for pages associated with objects (album.php, news.php, etc.) and gets the codeblock of the "current" object.

What you really need to be doing is using the object model to get the album codeblock. Your theme should use

$getcodeblock = $_zp_current_album->getCodeblock(); $codeblock = unserialize($getcodeblock); @eval('/>'.$codeblock[$number]);




getCodeBlock() not working in index.php in 1.4.0.3? - amucklow - 2011-05-03

Thanks!