3

Am trying in yootheme ZOO app to enable the rating element ONLY when the date element passed the today date but i cant find a way to get the item_id. If I try for example 277 everything is working, but how i can get the specific item id for each page?

I added those lines in the beginning of /media/zoo/applications/page/elements/rating/tmpl|rating.php

$app = App::getInstance('zoo');
$item = $app->table->item->get(277);
$element_id = "ffc8051a-fa18-4444-916c-bfbd74e2cb4e";
$element_value = $item->getElement($element_id)->getElementData()->get('value');
$eventdate = $element_value;
$now = date('Y-m-d H:i:s');

if (strtotime($eventdate) > $now) :
   echo "bla bla";
endif;
3

Ok found it out:

$item_id = $this->_item->id;
1

I found another easy way if your data was in Array:

In teaser.php or full.php you can access any information on element with code like this:

<?php  
$status = $item->getElement('0e3527e4-032c-4d35-a630-7b0418eb9ecc')->getElementData()->get('option');  
print_r($status['0']);   
?>

In some cases, 'option' need be replced by 'value'. You need access your data base and see the structure of element like this:

"0e3527e4-032c-4d35-a630-7b0418eb9ecc":  {
        "option":  {
            "0": "em-andamento"
        },
        "select": "1"
    },

See this other obeject structure ofr 'value' case:

"d9f72e0a-50d3-4be7-89f4-4d30b11aa5a1":  {
        "0":  {
            "value": "2015-11-18 02:00:00"
        }
    },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.