Log in | Register | Lost password

Bottom
Getting hold of publication ID in a block
  • Posted: 18.09.2008, 13:37
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Hello

    Not sure if this is Pagesetter specific, but anyways

    Here is the scenario: I have a pagesetter publication displayed in the main column of my layout, one of the fields in this publication is an image. I would like to display this image in a block in another column of the layout. To be concrete it is a presentation of a hockey player in a team, so I have the publication type Player with an image. This image I want to display in a block when the player details are displayed.

    In order to do this I need to get hold of the ID of the displayed publication from within a block. From there I could load the publication (again) and get hold of the image.

    As I am using Zikula I should be able to only show the block when a specific publication type is shown.

    So are there any tricks available to do this? I tried looking at the standard Smarty plugins, but the closest I found was something that would give me the URL (wich I would then have to parse).

    Regards


    Tor
  • Posted: 19.09.2008, 05:15
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Is the publication in the block being displayed randomly or by some other method?

    If you wanted to show the newest player (by newest publication), then you could just create two pagesetter blocks that display the same publication with two different templates.
  • Posted: 19.09.2008, 13:08
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Hmm

    Ok a bit more explanation. I have the publication type Player. Initially the user is presented the team roster (the list of players). A user then selects a Player from the list and the player details are shown using the Player-full.htm template (in the main column of the layout). When this "player detail" information is shown I would like a separate block (in another column of the layout) to show the image of the player. So if the chosen player has pid=12 I need to show the picture of the player with pid=12.

    I was thinking of having Zikula control when the playerImage block is shown using the advanced block control features.

    I may be stretching the possibilities here. The value I need is in the url of the page (tid and pid), so I guess it should be possible to grab it some way?

    Regards


    Tor
  • Posted: 21.09.2008, 05:09
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Why don't you just include an image upload field in your publication?
    Then there won't be any need for any fancy footwork with publication ids.
  • Posted: 22.09.2008, 09:48
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Well, the image is already in the publication. Well I actually solved this in a Smarty template for the block.

    Using

    Code

    <!--[pnvarcleanfrominput
    to get hold of the tid and pid and then

    Quote


    <!--[pnmodapifunc
    to load the right publication. The only not-good part of this solution is that I hook this template on the Pagesetter publication block, thus loading two publications from the database. In an optimal world I would only load the one with the right image. I tried to add my own bloc in pagesetter/pnblocks, but it did not show up in the "create block" menu in admin.

    Well, it works so optimizations will have to come later

    Regards


    Tor

Template courtesy of Designs By Darren.