Fork me on GitHub

PageMaster (Clip) viewpub shows array code, not specific items  Bottom

  • Using Z 1.2.4 and PM 0.4.2, created pubtype with a multicheckbox field based on a list created in Categories. The input form works fine. The output, however, shows the array code rather than the item.

    Array ( [10024] => Array ( [id] => 10024 [parent_id] => 10021 [is_locked] => 0 [is_leaf] => 0 [name] => Collaboration [value] => [sort_value] => 0 [display_name] => Array ( [en] => Collaboration ) [display_desc] => Array ( [en] => Collaboration ) [path] => /__SYSTEM__/Modules/PageMaster/lists/Topics/Collaboration [ipath] => /1/2/10001/10002/10021/10024 [status] => A [obj_status] => A [cr_date] => 2011-01-16 18:37:00 [cr_uid] => 2 [lu_date] => 2011-01-16 18:37:00 [lu_uid] => 2 [fullTitle] => Collaboration ) [10018] => Array ( [id] => 10018 [parent_id] => 10021 [is_locked] => 0 [is_leaf] => 0 [name] => Photography [value] => [sort_value] => 0 [display_name] => Array ( [en] => Photography ) [display_desc] => Array ( [en] => Photography ) [path] => /__SYSTEM__/Modules/PageMaster/lists/Topics/Photography [ipath] => /1/2/10001/10002/10021/10018 [status] => A [obj_status] => A [cr_date] => 2010-11-12 18:32:22 [cr_uid] => 2 [lu_date] => 2011-01-16 18:36:03 [lu_uid] => 2 [fullTitle] => Photography ) )


    How do I make it display the items selected rather than the array code? I've used pndebug to look for variables, but my coding skills...well... icon_frown

    Thanks.

    --
    Peace
    ______________________________________
    The commonest cause of problems is solutions.
  • Hey, I have just posted on pub categories too icon_smile : I have used the following code for my purpose:

    Code

    <!--[if !empty($multicheckboxfield.10024)]--> <!--[pmarray array=$multicheckboxfield.10024.name]--><!--[/if]-->


    Replace "$multicheckboxfield" with your field variable and it will display the name of your category with id = 10024.
    Hope it helps.
    Philippe



    Edited by pnFilip on Jan 17, 2011 - 05:37 PM.
  • Thank you. That's a step in the right direction. It would work fine if it reflected a radiobox field or a select from dropdown field. Its a multicheckbox, so it needs to loop through the array and display all the checked boxes, not just the one I specify by id.

    That will certainly be a stretch for my coding skills, but I'll start playing.

    plemplem



    Edited by pheski on Jan 17, 2011 - 12:29 PM.

    --
    Peace
    ______________________________________
    The commonest cause of problems is solutions.
  • yes, in my case, I have successively tested one by one all the multiple chechboxes:

    Code

    <!--[if !empty($multicheckboxfield.10024)]--> <!--[pmarray array=$multicheckboxfield.10024.name]--><!--[/if]-->
    <!--[if !empty($multicheckboxfield.10025)]--> <!--[pmarray array=$multicheckboxfield.10025.name]--><!--[/if]-->
    <!--[if !empty($multicheckboxfield.10026)]--> <!--[pmarray array=$multicheckboxfield.10026.name]--><!--[/if]-->


    Give more explanations about your case.
    Philippe
  • This also seems to work, and means I don't have to redo this snippet every time I add a new topic to my multicheckbox list
    :

    Code

    <!--[foreach from=$topics item='id']-->
        <!--[$id.name]-->::
        <!--[/foreach]-->


    --
    Peace
    ______________________________________
    The commonest cause of problems is solutions.
  • Thanks for sharing, much better solution without using category ids.
  • The array is showing us the posibilities to display then maybe you can use.

    Code

    <!--[if !empty($multicheckboxfield)]--> <!--[$multicheckboxfield.id|pnvarprephtmldisplay]--><!--[/if]-->


    to display id number or

    Code

    <!--[if !empty($multicheckboxfield)]--> <!--[$multicheckboxfield.name|pnvarprephtmldisplay]--><!--[/if]-->


    to display name or better

    Code

    <!--[if !empty($multicheckboxfield)]--> 
     <a href="<!--[pnmodurl modname='PageMaster' type='user' tid=$core_tid filter=multicheckboxfield:eq:]--><!--[$multicheckboxfield.id]-->">
    <!--[$multicheckboxfield.name|pnvarprephtmldisplay]--></a><!--[/if]-->


    to create a link to display a list filtered by this cat.

    Hope this helps
  • And maybe someone make a correction but the cat list will be something like this







    hope this helps



    Edited by orion1970 on Jan 20, 2011 - 02:19 PM.
  • You can let Smarty parse dynamic values for your filter like:

    Code

    filter="multicheckboxfield:eq:`$multicheckboxfield.id`"

    without the need of split them appart ;)

    --
    - Mateo T. -
    Mis principios... son mis fines
  • icon_smile



    Edited by pheski on Jan 20, 2011 - 04:27 PM.

    --
    Peace
    ______________________________________
    The commonest cause of problems is solutions.

This list is based on users active over the last 60 minutes.