Combine elements using calc [Solved]

focault

Member
Ok I have 3 elements in a form that I want to combine so an image uploaded will be linked and have an alt text value of a element.

{tablename___name} - field element
{tablename___image} - ajax upload element
{tablename___link} - link element

So I guess I should use a calc element to get this working so that the image is displayed and its alt is the name element and also it is a link using the link element and it should open in a new browser tab.
Any Ideas?
 
This calc code worked for me:

PHP:
$alt = htmlspecialchars('{tablename___name}', ENT_COMPAT, 'UTF-8');
$src = JUri::root() . '{tablename___image}';
$src = str_replace('\', '/', $src);
$link = json_decode($data['tablename___link_raw']);
 
return '<a href="' . $link->link . '"><img src="' . $src . '" alt="' . $alt . '" /></a>';
 
Hi, this displayed the text for the Name element and it was a link with the value of the Link element but the image did not display and the link is opening in the same window now a new one.

Here is what it looks like in firebug:

<tr class="fabrik_row oddRow0" id="list_23_com_content_23_row_5">
<td class="jfync_fblist_sponsors___sponsorcalc fabrik_element fabrik_list_23_group_52">
<a href="http://123Inkt.nl"><img alt="123Inkt" src="http://localhost/mokum/[{&quot;file...uot;w/&quot;:730,/&quot;h/&quot;:90}}&quot;}]"></a> </td>
</tr>
 
For opening the link in a new window/tab add
<a target="_blank"....
Image name: is this a fileupload element with multiple images uploaded?
 
Your filename seems to be a bunch of html-encoded crop params.
Do you have crop enablee?
But even with crop it's working with Rob's code on my site.
 
hi Odd! I did test with an ajax upload element.
I guess this is not on the Fitness site but another site? If you fill in a new "my sites" entry I will take a look and see what is causing the discrepancy
 
ok so its due to it being limited to 1 - looking at how to change the calc now.....
 
This should work for a single image;
PHP:
$alt = htmlspecialchars('{tablename___name}', ENT_COMPAT, 'UTF-8');
$src = json_decode($data['tablename___image_raw']);
$src = JUri::root() . $src[0]->file;
$src = str_replace('\', '/', $src);
 
$link = json_decode($data['tablename___link_raw']);
 
 
return '<a href="' . $link->link . '"><img src="' . $src . '" alt="' . $alt . '" /></a>';
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top