Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

html tags in language variables

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-09-2016, 07:39 AM
 
Mariusz Mariusz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 55
 

Lightbulb html tags in language variables

Hi guys

I'm trying to add a google map link to the contact on the footer:
<a href="https://www.google.ca/maps/place/2120+Bristol+Cir,+Oakville,+ON+L6H+6P5/@43.5129587,-79.6730482,17z/data=!3m1!4b1!4m2!3m1!1s0x882b4375072b56af:0xc64bf cd8c3e36361" target=_blank">map</a>

But instead of just displaying the word map in the footer with the link, it shows all the above text in its entirety.

Are there certain tags that are not allowed?
__________________
X-Cart
Version 4.5.4
Version 5.1.11
Version 5.2.15 x3
Reply With Quote
  #2  
Old 03-09-2016, 08:54 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: html tags in language variables

I believe it depends on the template that displays the language variable.
Some templates use modifiers that escape special characters, other templates show language variables "as is".
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 03-09-2016, 11:03 AM
 
Mariusz Mariusz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 55
 

Default Re: html tags in language variables

Hi Alex

We are using the clothing template.

Some of the language variables have html tags in them.
__________________
X-Cart
Version 4.5.4
Version 5.1.11
Version 5.2.15 x3
Reply With Quote
  #4  
Old 03-09-2016, 09:27 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: html tags in language variables

I mean template files, not the "design template" itself. Language variables are displayed from template files, and some template files escape special characters, while others don't do this.

You should find the file that displays the message and change it so that it won't escape HTML tags.

Is it for X-Cart 4, or X-Cart 5? These versions use different template engines, so the answer will be different.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #5  
Old 03-10-2016, 04:36 AM
 
Mariusz Mariusz is offline
 

Advanced Member
  
Join Date: Feb 2008
Posts: 55
 

Default Re: html tags in language variables

HI Alex

We are using xcart 5.2.13.

From our understanding we need to use webmaster mode and edit the template file that way and not from the language variables?
__________________
X-Cart
Version 4.5.4
Version 5.1.11
Version 5.2.15 x3
Reply With Quote
  #6  
Old 03-14-2016, 02:50 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: html tags in language variables

There are two parts:
- the language variable
- the template file that displays the language variable

If you want to insert the HTML to into the language variable, you should edit the variable.

However, some templates escape HTML in language variables. If this happens to you, you should edit the template too and add ":h" modifier to the code that displays the language variable.

For example, in the attached screenshot I was editing the template that displays the welcome text on the home page. It is not a language variable, but the idea is the same. The text is displayed by this code: "{getDescription():h}". Without the ":h" the template will escape HTML in the text. This is what you should add to the template if you want it to render HTML as it is.

However, please note that this may raise the risk of your site being hacked. Don't render HTML in text that was supplied by regular users.
Attached Thumbnails
Click image for larger version

Name:	1457955843735screensave.png
Views:	143
Size:	49.4 KB
ID:	4503  
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:24 PM.

   

 
X-Cart forums © 2001-2020