ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

assign custom field to php array var?

February 23, 2012 11:16am

Subscribe [2]
  • #1 / Feb 23, 2012 11:16am

    dabcat

    7 posts

    Is it doable to assign custom field values to php array? Something like

    {exp:channel:entries channel="challenges" require_entry="yes" limit="1" cache="yes" refresh="60"}
    
    {reverse_related_entries id="week_stats"}
    <?php
    $i = 1;
    $stats[$i]['fat'] = "{body_fat}";
    $stats[$i]['weight'] = "{weight}";
    $stats[$i]['biceps'] = "{bicep_left}";
    $stats[$i]['chest'] = "{chest}";
    $stats[$i]['thigh'] = "{thigh_left}"
    $i++
    ?>
    
    {/reverse_related_entries}
    <?php print_r($stats);?>
    ...
    ...
    ...
    {/exp:channel:entries}

     

  • #2 / Feb 23, 2012 11:43am

    Bhashkar Yadav

    727 posts

    this will never work either you are setting template “PHP Parsing Stage” as INPUT or OUTPUT.

    why don’t you try with only PHP code to fetch reverse related entries. it will work well for assigning values into array.

  • #3 / Feb 24, 2012 3:29am

    dabcat

    7 posts

    Yes of course with PHP parsing as output.

    How do you mean to fetch reverse related entries with PHP code only? Via custom query? Can you show me example? 😊

    Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases