Getting an album's codeblocks when you're on image page?

HI,

I'm a new user, but I've searched and searched before posting a forum question, honestly!

I'm struggling to get hold of the codeblocks that belong to an album when viewing an image within the album. Initially I had assumed that the album's codeblocks would be inherited, but now I see this is not the case, and that each image has it's own codeblock, but from reading the description of the printCodeblock() function it appears I should be able to do something along these lines:
[code]<?php $codeblock2=$_zp_current_album->getcodeblock (2);
if ($codeblock2 <> '') { printCodeblock (2,'Randoms'); }
?> [/code]

If I'm understanding right this should be checking that the album's codeblock 2 is not empty, then executing it. The album is called 'Randoms'. I have tried things like GetAlbumTitle () instead of the explicit string, and also GetAlbumLinkURL (), but nothing seems to give me the album's codeblocks.

Any help will be much appreciated.

Comments

  • You have a bit of mixex context in your code. `printCodeBlock()` has an optional second parameter. If you choose to pass it, it must be the Object for which you want the codeblock. You passed a string to that parameter, not an object. Pass instead `$_zp_current_album`.
  • teeps Member
    That's great, thanks sbillard.

    However, now that I have the code as this:
    <?php $codeblock2=$_zp_current_album->getcodeblock (2); if ($codeblock2 <> '') { echo 'EEP '; printCodeblock (2,$_zp_current_album); }?>

    I get the following output ` a:3:{i:1;s:372:"Download a zip file of this album

    marktuma.net";i:2;s:13:"CODEBLOCK 2 ";i:3;s:0:"";} `

    The codeblock itself contains just the text 'CODEBLOCK 2'.

    It looks like it's getting more than the codeblock requested but I can't see why. Can you suggest anything please?
  • Seems there is an error in the function. Guess you are the first to try that option. I will get a fix up in the nightly build for tonight. If you want to make a temporary fix yourself you can change the code for printCodeblock() in template-functions.php. There is a line that reads `$codeblocks = unserialize($codeblock);` Add immediately following `$codeblock = $codeblocks[$number'];`
  • teeps Member
    Thanks sbillard, that fixed it!

    In case anyone finds it useful, I've been documenting my experiences with setting up Zenphoto and getting it tweaked to my liking here: http://marktuma.net/?p=231
Sign In or Register to comment.