PDA

View Full Version : Using Variables in templates


madboyo
22-Jan-2010, 10:10 AM
I guess this is a general question for future reference and my education based on a specific template mod I have tried.

Making the LOGOIMAGE into a link to the homepage.

I've searched the forums (not just the V7 forum) and have found various articles on how to achieve this.

http://community.actinic.com/showthread.php?t=42065&highlight=logoimage+as+link

http://community.actinic.com/showthread.php?t=13624&highlight=logoimage+as+link


The way I thought I would go about it was to edit the Act_LogoImage.html.

<!-- LogoImage HTML begin -->
<!-- This file is used to build the logo image markup. -->
<A HREF="index.html">
<IMG SRC="NETQUOTEVAR:IMAGEFILE"
ALT="NETQUOTEVAR:ALTERNATETEXT"
BORDER=0
NETQUOTEVAR:IMAGEHEIGHT
NETQUOTEVAR:IMAGEWIDTH
NETQUOTEVAR:OTHERIMAGEMARKUP>
<!-- This file is used to build the logo image markup. -->
<!-- LogoImage HTML end -->


I've found that when I specify "index.html" or whatever page I wish to use the link works on a live site but won't work in Offline Preview because the homepage name is prefixed with P_.

So trying to be clever I thought I would use a variable so that Actinic could manage the path dynamically so that it works for Preview and Live sites.

I checked www.w3schools.com http://www.w3schools.com/HTML/tryit.asp?filename=tryhtml_imglink

I searched the Adv Usr Guide and found the BASEHREF variable which is described as being the "base url of the actinic store" taken from the Network Settings.

I also looked at the Act_NavigationItem.html that was talked about in one of the above threads and saw how the variable is inserted into code but when I use the example below it doesn't work.

<!-- LogoImage HTML begin -->
<!-- This file is used to build the logo image markup. -->
<A HREF="NETQUOTEVAR:BASEHREF">
<IMG SRC="NETQUOTEVAR:IMAGEFILE"
ALT="NETQUOTEVAR:ALTERNATETEXT"
BORDER=0
NETQUOTEVAR:IMAGEHEIGHT
NETQUOTEVAR:IMAGEWIDTH
NETQUOTEVAR:OTHERIMAGEMARKUP>
<!-- This file is used to build the logo image markup. -->
<!-- LogoImage HTML end -->


When you hover over the logo the status bar of the browser shows the code i.e. netquotevar:basehref not the value assigned to that variable.

Why? What am I missing?

peblaco
22-Jan-2010, 10:26 AM
NETQUOTEVAR:BASEHREF is the used for the base reference tag in the header to tell the cart, checkout and search where to load images from the main store folder. It's not intended for template link use, try NETQUOTEVAR:NAVBHOMELINK instead.

madboyo
22-Jan-2010, 10:37 AM
<!-- LogoImage HTML begin -->
<!-- This file is used to build the logo image markup. -->
<A HREF="NETQUOTEVAR:NAVBHOMELINK">
<IMG SRC="NETQUOTEVAR:IMAGEFILE"
ALT="NETQUOTEVAR:ALTERNATETEXT"
BORDER=0
NETQUOTEVAR:IMAGEHEIGHT
NETQUOTEVAR:IMAGEWIDTH
NETQUOTEVAR:OTHERIMAGEMARKUP></A>
<!-- This file is used to build the logo image markup. -->
<!-- LogoImage HTML end -->

Thank you Peblaco for the suggestion. I have tried the other variable but the end result is the same in the status bar.

After opening the file I did also spot that I omitted </A> I take it I've put it in the correct position. It is as far as the example on w3schools shows.

peblaco
22-Jan-2010, 10:41 AM
I have tried the other variable but the end result is the same in the status bar.
Some variables cannot be used in certain layouts, it should work in a primary but may not if you are putting it into the logo. Does it need to be into the logo template or can you put the link into the primary?.

madboyo
22-Jan-2010, 10:53 AM
NAVBHOMELINK doesn't exist in V7.0.7 according to the Adv Usr Guide but NAVBHOME does but again that doesn't work.

I'll try one of the other examples and edit the Act_Primary.html instead. If not I'll guess I'll settle for using http://<mysite.com>/index.html

Thanks for your help

peblaco
22-Jan-2010, 10:55 AM
I'll try one of the other examples and edit the Act_Primary.html instead. If not I'll guess I'll settle for using http://<mysite.com>/index.html

Or rather than hard coding a link into a template and forgetting where you set it, add a new custom variable and set the link in the Actinic menu, then you put CUSTOMVAR:LINK into the layout and only have to change your link under an Actinic menu in one place in future.