Forum

Thread tagged as: Question, Problem

Storing output as a variable

Hi, I need to do some logic an output that already has been processed by logic in the templates. I try to store it as a variable, but nothing is outputed. I know i can use the skip-template option, but that would not filter the content correctly. The output should be a simple string.

Here is the code:

   $filteredlinkarray = perch_content_custom('Link Builder', array(
   'filter'=>'campaign.url_id',
   'match'=>'eq',
   'value'=>$uniqueurl,
   'raw' => 'true'
    ));
   print_r($filteredlinkarray);
   echo($filteredlinkarray);
Erling Hoff

Erling Hoff 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

If I am understanding the question correctly you need to add "true" as a third parameter.

perch_content_custom('Link Builder', array(
   'filter'=>'campaign.url_id',
   'match'=>'eq',
   'value'=>$uniqueurl,
   'raw' => 'true'
    ), true);

There is also the ability to add a callback function - that's detailed in the docs: https://docs.grabaperch.com/docs/content/perch-content-custom/