Quotes in VAR values?

General ShopSite user discussion

Quotes in VAR values?

Postby davee123 » Sun Nov 04, 2007 7:52 pm

I was trying to do something like this:

[-- VAR.mylink "<a href="mylink.html">Link Text</a>" --]

Except... well, obviously that won't work, because there's quotes in the value! I tried a few more-or-less standard things like:

[-- VAR.mylink '<a href="mylink.html">Link Text</a>' --]
[-- VAR.mylink "<a href=\"mylink.html\">Link Text</a>" --]
[-- VAR.mylink "<a href=&quot;mylink.html&quot;>Link Text</a>" --]

But these didn't seem to work. Is there any way to actually put quotes in there?

DaveE
davee123
 
Posts: 8
Joined: Tue Oct 09, 2007 7:56 am
Location: Massachusetts, USA

RE: Quotes in VAR values?

Postby ShopSite Lauren » Mon Nov 05, 2007 10:08 am

I don't know of a way to put quotes in the VAR tags. However, you can set up the VAR tag with the URL in it:

[--VAR.mylink http://mylink.com/index.html --]

Then in the code, you can include the code for the link, and just use the var for the URL. For example:

<a href="[-- VAR.mylink --]">My Link</a>

-Lauren
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: RE: Quotes in VAR values?

Postby davee123 » Mon Nov 05, 2007 10:33 am

ShopSite Lauren wrote:I don't know of a way to put quotes in the VAR tags.


Aww, booo! :(

ShopSite Lauren wrote:However, you can set up the VAR tag with the URL in it:

[--VAR.mylink http://mylink.com/index.html --]

Then in the code, you can include the code for the link, and just use the var for the URL. For example:

<a href="[-- VAR.mylink --]">My Link</a>


Yep! For now, I don't actually need the double quotes, because HTML is sloppy and will interpret my links just fine without double quotes. But god forbid someday that I need something like:

[-- VAR.my_img "<img src=/images/foo.gif onmouseover="javascript:alert('you\'re on my page')">" --]

Essentially, I'm setting a variable for shorthand-- I could just put it in hard-coded to use the double quotes, but that would seem to defeat the purpose. I suppose the god-forbid solution would be to put it in an include file, so it's a composition of VAR's and INCLUDE's, but blech :(

DaveE
davee123
 
Posts: 8
Joined: Tue Oct 09, 2007 7:56 am
Location: Massachusetts, USA


Return to User Forum

Who is online

Users browsing this forum: No registered users and 135 guests