Jump to content

[solved] Adding links to img in Block reinsurance - how?


Recommended Posts

you can do it in modules/blockreinsurance.tpl file but you must make a little modification, here's the know how:

 

now foreach looks like:

 

 {foreach from=$infos item=info}
  <li><img src="{$module_dir}img/{$info.file_name}" alt="{$info.text|escape:html:'UTF-8'}" /> <span>{$info.text|escape:html:'UTF-8'}</span></li>
 {/foreach}

 

you must edit it like below:

 

 {foreach from=$infos item=info}
	    {if $info.id_reinsurance==1}{$url="http://url.here.com"}{/if}
	    {if $info.id_reinsurance==2}{$url="http://url.here.com"}{/if}
	    //other reinsurance ids
  <li><a href="{$url}"><img src="{$module_dir}img/{$info.file_name}" alt="{$info.text|escape:html:'UTF-8'}" /> <span>{$info.text|escape:html:'UTF-8'}</span></a></li>
 {/foreach}

  • Like 1

Share this post


Link to post
Share on other sites
  • 2 months later...
  • 4 months later...

hello all

I'm really glad that it is helpfull, but i want to add something to what i said above.

it's better to use this method to define $url:

{assign var=url value='http://url.to.page/test/'}
  • Like 1

Share this post


Link to post
Share on other sites
  • 7 months later...

Vekia,

 

The url variable needs to be set to a default value. Now all rows in the reinsurance block get "linked". And if the correct ID is not specified it will get the default link.

Secondly the ID will change when a user will delete a row. So then you need to constantly change the hardcoded links. 

I hope this modules gets the option to add links by default.

Share this post


Link to post
Share on other sites

Here is my current code

 

{assign var=url value='#'}
{foreach from=$infos item=info}
   {if $info.id_reinsurance==1}{assign var=url value='http://www.google.com'}{/if}
   {if $info.id_reinsurance==2}{assign var=url value='http://url.to.page/test/'}{/if} 
<li><a href="{$url}" alt="{$info.text|escape:html:'UTF-8'}" title="{$info.text|escape:html:'UTF-8'}" ><img src="{$module_dir}img/{$info.file_name}" alt="{$info.text|escape:html:'UTF-8'}" /></a></li>
{/foreach}
Edited by uddhava (see edit history)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More