Jump to content

Adding a mailto: email link as a product feature value


Recommended Posts

Hi, what I'm trying to do is have some of my features as an external email address to contact about the product. I have done this similarly to add href hyperlinks to specific websites for the product, etc with no issues (see code below).

 

But for the href="mailto:[email protected]" it is giving an error.

 

This is my code:

 

{foreach from=$features item=feature}
<tr class="{cycle values="odd,even"}">
{if isset($feature.value)}




{if $feature.name eq "Website URL"}
<td>{$feature.name|escape:'html':'UTF-8'}</td>
<td><a href="http://{$feature.value|escape:'html':'UTF-8'}" target="_blank">{$feature.value|escape:'html':'UTF-8'}</a></td>


{if $feature.name eq "General Email Address"}
<td>{$feature.name|escape:'html':'UTF-8'}</td>
<td><a href="mailto:{$feature.value|escape:'html':'UTF-8'}">{$feature.value|escape:'html':'UTF-8'}</a></td>
 
The resulting error says:
 
Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/..../themes/default-bootstrap/product.tpl" on line 568 "{/foreach}" unclosed {if} tag <-- thrown in/.../tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 568
 
Any help would be appreciate :)
 
Link to comment
Share on other sites

I am sure that this is not all code, so my suggestion maybe not quite right, but i hope you will get the idea

 

The code you provided look like this:

1. foreach

1.1. if

1.1.1. if

1.1.1.1. if

 

The part that is missing should close all the open tags and it should go in reverse order.

first you close the deepest if and the last you close foreach

 

Closing tags look like this:

{/if}
{/foreach}

The error you provided says that you are missing one closing tag.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...