Buy Now
Sign in

set var and loop function doubt

emmexx , October 24 2018, 14:36
emmexx 447
October 24 2018, 14:36 #381035
I'm not sure I'm using some of the ccv6 features correctly.
Loop function
I believed the difference between the repeater view and the loop function had something to do with an MVC pattern but the loop function seems to output everything unless you put the result in a var.
What's the difference between the two?
I put the following code in a php function (myphp):
$tmp = $this->get('gOutside', 
  • );
  • = ("aField" = 45);
    $this->set('gOutside', $tmp);
    I put this function in a loop function (myloop).
    I create an event with content:
    I expect to find gOutside in the output of the debug function but it is not there.
    I change the event to:
    and the content of gOutside is displayed.
    Why is that?
    I chenge the content of the event to:
    but foo is not there to be seen.
    I want to use gOutside as a provider of another function but it's not working. I also tried creating another php function that return gOutside but that too is empty for other functions [EDIT: I can't reproduce this, now it seems to work, it could be because now the loop is set to return the result as var].
    I am missing something but what is it?
    Thank you
    healyhatman 8
    October 25 2018, 05:45 #381046
    Well yes if you don't set it to return as a var, it won't return as a var - it will print it.
    Web developer at - I DO NOT work for ChronoEngine!
    Professional Work:
    Custom CF / CC Plugins and Extensions:
    emmexx 447
    October 29 2018, 11:34 #381125
    Well yes if you don't set it to return as a var, it won't return as a var - it will print it.
    I'm not sure that is the actual behaviour. Or I'm using the loop the wrong way.
    Other code that is not working as I expect:
    In the loop body I put
    The loop is set to return as var.
    ret_a_string is a php function that... returns a string or echoes a string:
    echo "test string";
    return "test string";
    The debug output as no info about the loop. Where is the loop var value?
    I found another problem:
    in the loop body field the var.set or data.set is not working with other var values:
    I had to use a php function instead and set the data value there.