Passing variables

General ShopSite user discussion

Passing variables

Postby VinceS » Wed Jan 28, 2015 11:57 am

We are changing our phone numbers. Well not so much changing as dropping our Toll Free number, but since I'm going thru the effort of changing them everywhere on the site, I thought it a good idea to make the phone numbers, FAX number, address etc variables defined in a single include rather than hard coded in the Page Text and Product More Information text.

It's working fine from the page banner and footer template includes, but I can't get the variable value to pass to the HTML of the Page Text 1 and I'm guessing it wont work in the Product More Information Page Text either.

So again. this is the AC_Contact include template that defines the variables
# Created 01/28/2015
<!-- Begin AC_Contact -->
[-- VAR.PhoneNumber "908-464-5581" --]
[-- VAR.FAXNumber "866-454-7459" --]
[-- VAR.CompanyName "AhoyCaptain" --]
[-- VAR.Street "34 Fairfax Drive" --]
[-- VAR.City "Berkeley Heights" --]
[-- VAR.State "NJ" --]
[-- VAR.Zip "07922" --]
<!-- End AC_Contact -->

Here's the include template that renders the page header

<!-- Begin AC_Banner -->
[-- INCLUDE AC_Contact PROCESS --]
<table align="center" width="1000" border="0" cellpadding="0" cellspacing="0">
<tr><td height="5" bgcolor="#ffffff" colspan="2"></td></tr>
<tr>
<td bgcolor="#355F99"><a href="http://www.ahoycaptain.com">
<img border="0" src="https://www.ahoycaptain.com/media/home/AC_Logo.jpg" width="155" height="120"></a></td>
<td background="https://www.ahoycaptain.com/media/home/[-- VAR.HeaderImage --]" width="845" height="120">
<p class="tag_line"><i>Expert Outfitters<br>Experienced Boaters</i><br>Call [-- VAR.PhoneNumber --]</p>
...........................
...........................
</td>
</tr>
</table>
<!-- End AC_Banner -->

The above works fine.

What doesn't work is this code in the Page Text 1 HTML code, even though every page on the site is created with the AC_Banner include above.
<h1>Contact Information</h1>
<p><span>Have a question or comment for AhoyCaptain? Call us! [-- VAR.PhoneNumber --}</p>


I hope this makes sense to the reader(s) of this post. If what I'm trying to do here can't work, can anyone suggest an alternative.
VinceS
 
Posts: 134
Joined: Fri Apr 06, 2007 1:26 pm

Re: Passing variables

Postby loren_d_c » Wed Jan 28, 2015 12:02 pm

You're saying that you are putting template tags in a page's Text 1 field? That's not going to work. Template tags only work in the templates themselves.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Re: Passing variables

Postby VinceS » Wed Jan 28, 2015 12:25 pm

Thanks Loren that is what I'm doing.

Do you have any suggestions for how I might define a variable that can be referenced from the various text fields? Page and Product.
VinceS
 
Posts: 134
Joined: Fri Apr 06, 2007 1:26 pm

Re: Passing variables

Postby loren_d_c » Wed Jan 28, 2015 1:56 pm

No, not a ShopSite template variable. If you wanted to use JavaScript instead, you could set up a JavaScript variable in one of those text fields. Or if your pages are PHP pages you could set a PHP variable.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere


Return to User Forum

Who is online

Users browsing this forum: No registered users and 16 guests