attribute content displaying in certain area
Permalink
I have a custom image attribute in my pages called thumbnail. Now i want the content of this attribute to show up in a specific Area of my custom page template.
I managed to display the attribute content outside an area by using this code in my page template:
<?php
echo ("<img src=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getRelativePath());
echo ("\" alt=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getDescription());
echo ("\"/>");
?>
It shows up the way i want, but it needs to be inside the area 'Recent':
<?php
$a = new Area('Recent');
$a->display($c);
?>
How can i do this?
I managed to display the attribute content outside an area by using this code in my page template:
<?php
echo ("<img src=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getRelativePath());
echo ("\" alt=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getDescription());
echo ("\"/>");
?>
It shows up the way i want, but it needs to be inside the area 'Recent':
<?php
$a = new Area('Recent');
$a->display($c);
?>
How can i do this?
add a php block and put your above code into it.
Do you mean like this? (sorry my knowledge of php is very little)
<?php
$a = new Area('Recent');
$a->display($c);
echo ("<img src=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getRelativePath());
echo ("\" alt=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getDescription());
echo ("\"/>");
?>
<?php
$a = new Area('Recent');
$a->display($c);
echo ("<img src=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getRelativePath());
echo ("\" alt=\"");
echo ($c->getAttribute('thumbnail')->getVersion()->getDescription());
echo ("\"/>");
?>
that will display it at the end of the recent area- so if thats what you want, sure. If not, download the php block from the marketplace, and then put the code from your original post into that block, and move the block to where you want it.
Ok thanks, i'm gonna try this!