Hi,
I’m trying to store the value of a template-tag into a php-variable but is this even possible?
I want the user to enter a flickr-url(ex.:http://www.flickr.com/photos/trackgent/sets/72157627336324121/) in this field and I want to extract the set-id from it using php, but mayby there is another way?
This is my code for the moment, just trying to get the right value:
{exp:channel:entries channel="kunstenaars" status="open"}
{exp:ce_img:pair src="{artist_header_img}" width="355" height="202"}
{made}
{/exp:ce_img:pair}
<h2>{title}</h2>
{artist_txt_{country_code}}
<?php
$art_gallery_url = "{art_gallery}";
?>
{/exp:channel:entries}
<section id="art-gallery">
<?php
echo $art_gallery_url;
?>
<ul>
{exp:eehive_flickr:photoset set_id="72157627336324121" size="medium"}
<li {if count == 1}class="active"{/if}>
<a href="#">_ {flickr_url_medium}_ </a>
</li>
{/exp:eehive_flickr:photoset}
</ul>
<div class="controls">
<a href="#" class="next">></a>
<a href="#" class="prev"><</a>
<a href="#" class="close">x</a>
</div>
</section>If I put the parsing-stage setting to output, I get a php error: Parse error: syntax error, unexpected T_STRING in /opt/www/gonzales/web/www.track.be/system/expressionengine/libraries/Functions.php(656) : eval()’d code on line 15
If I use the input stage I get the template tag {art_gallery} when echooing my variable with php.
Hi there,
Are you calling in more than 1 entry from your kunstenaars channel? If so then your probably trying to echo an array, in which case the following would be better
<?php print_r($art_gallery_url); ?>If however you’re only calling 1 entry form your kunstenaars channel, you shouldn’t need to have php and can use the following
{exp:channel:entries channel="kunstenaars" status="open" limit="1"}
{exp:ce_img:pair src="{artist_header_img}" width="355" height="202"}
{made}
{/exp:ce_img:pair}
<h2>{title}</h2>
{artist_txt_{country_code}}
<section id="art-gallery">
{art_gallery}
{/exp:channel:entries}
<ul>
{exp:eehive_flickr:photoset set_id="72157627336324121" size="medium"}
<li {if count == 1}class="active"{/if}>
<a href="#">_ {flickr_url_medium}_ </a>
</li>
{/exp:eehive_flickr:photoset}
</ul>
<div class="controls">
<a href="#" class="next">></a>
<a href="#" class="prev"><</a>
<a href="#" class="close">x</a>
</div>
</section>Thanks for helping out, FD! gonzales - those look like good options. Depending on what you’re doing, it may be better to look at something like the String Plugin and avoid needing PHP in your template at all.
And of course, welcome to our community =) II’ve also moved this down to Dev & Programming for you.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.