This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » ezPublish, concat, php and variables
expandshrink

ezPublish, concat, php and variables

ezPublish, concat, php and variables

Thursday 30 January 2014 3:58:45 pm - 1 reply

Hello everyone, I have a template in which a php function call.

{def $url = concat('/social_manager/getJSON/instagram/',$queryInstagram,'/',$nInstagram,'/',$usersInstagram,'/'$template'/')}

La funzione php deve recuperare i parametri da Instagram e ritornarmi i risultati in un array. Questo array viene da me formattato con i tag html.

 include_once( "kernel/common/template.php" );
include_once('extension/elle3/classes/socialManager.php');
$tpl = templateInit();
 
$json_return = $social->getJsonMedia();
$data = json_decode($json_return);
switch ($Params['template']) {<span> </span>
<span style="white-space: pre;"> </span>case 'Box2c600HashTag':<span> </span>{<span> </span>
$esito = ''.PHP_EOL;<span> </span>
foreach ($data->data as $key=>$value) <span> </span>{<span> </span>
$esito .= '<div class="item"><span> </span>
<div class="hashtag"><span> </span>
<div class="contHashtag"><span> </span>
<div class="bg"><span> </span>
<a href="" class="post"> 
<img src="'.$value->images->low_resolution->url.'" /> 
</a><span> </span>
<a href="" class="account"><span> </span>
<img src="'.$value->caption->from->profile_picture.'" /> 
<span>'.$value->caption->from->username.'</span><span> </span>
<span class="data">'.htmlentities(strftime('%e %B %Y', $value->caption->created_time + 7200)).'</span>
<span> </span></a><span> </span>
</div><span> </span>
</div><span> </span>
</div><span> </span>
</div>'.PHP_EOL;<span> </span>
}
<span> </span>}
<span> </span>break;<span> </span><span> </span>default:<span> </span>$esito = ''.PHP_EOL;<span> </span>break;
}
echo $esito;
eZExecution::cleanExit();
I now have to display the contents of the template $esito. 
How do I recover data? If I enter {$url} in the template, I can not see anything. 
Does anyone have any idea? 
Thanks

Friday 31 January 2014 2:45:14 pm

You can try {$url|attribute('show')} 

The attribute operator will let you see the data in the variable.

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-operators/Miscellaneous/attribute

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from