Opening Multiple Store Locations will like stylesheet link per location.
-
- New Member
- Posts: 6
- Joined: Mon Apr 26, 2010 4:59 am
Opening Multiple Store Locations will like stylesheet link per location.
Opening Multiple Store Locations
I will like a seperate stylesheet dynamically inserted for each location based on the location in the URL.
This is so each location can have their own color scheme.
Also where the text of the location is listed will need that text filtered out and replaced with the correct City and State text.
Example text
http://allseasonswindows.com/east-texas/
The finest East Texas windows and doors.
http://allseasonswindows.com/shreveport/
The finest Shreveport / Bossier City windows and doors.
http://allseasonswindows.com/houston/
The finest Houston TX windows and doors.
I will like a seperate stylesheet dynamically inserted for each location based on the location in the URL.
This is so each location can have their own color scheme.
Also where the text of the location is listed will need that text filtered out and replaced with the correct City and State text.
Example text
http://allseasonswindows.com/east-texas/
The finest East Texas windows and doors.
http://allseasonswindows.com/shreveport/
The finest Shreveport / Bossier City windows and doors.
http://allseasonswindows.com/houston/
The finest Houston TX windows and doors.
- stijlXpres
- Forum Members
- Posts: 137
- Joined: Tue May 05, 2009 12:10 pm
Re: Opening Multiple Store Locations will like stylesheet link per location.
Hi,
I think I can help you out with your problem. Could you give me some more information?
I think I can help you out with your problem. Could you give me some more information?
-
- New Member
- Posts: 6
- Joined: Mon Apr 26, 2010 4:59 am
Re: Opening Multiple Store Locations will like stylesheet link per location.
Sorry I just saw this post. There should be no database stuff. Just .htaccess and a little php.stijlXpres wrote: Hi,
I think I can help you out with your problem. Could you give me some more information?
It will involve finding locations hard coded in the HTML and replacing with a
.htaccess and mod rewrite to take the location embedded in the URL and save that url segment into the $location variable. also replace dashes in the url with spaces and capitalize the location in the page output but not the URL use for that.
- stijlXpres
- Forum Members
- Posts: 137
- Joined: Tue May 05, 2009 12:10 pm
Re: Opening Multiple Store Locations will like stylesheet link per location.
Hmm,
I'm afraid I only know a solution where smarty variables and therefore 'database stuff' is used...
I don't know much about mod_rewrite...
Sorry!
I'm afraid I only know a solution where smarty variables and therefore 'database stuff' is used...
I don't know much about mod_rewrite...
Sorry!
-
- New Member
- Posts: 6
- Joined: Mon Apr 26, 2010 4:59 am
Re: Opening Multiple Store Locations will like stylesheet link per location.
I am sure your way is better, This needs to be fixed. How much will it cost me? I need availability by phone, email, IM, and your working schedule with timezone. How quickly can you respond with this info?stijlXpres wrote: Hmm,
I'm afraid I only know a solution where smarty variables and therefore 'database stuff' is used...
I don't know much about mod_rewrite...
Sorry!
Re: Opening Multiple Store Locations will like stylesheet link per location.
Please don't use CAPS like that as it only makes it look like your yelling
...

-
- New Member
- Posts: 6
- Joined: Mon Apr 26, 2010 4:59 am
Re: Opening Multiple Store Locations will like stylesheet link per location.
OK Sorry i thought it was lowercase.Dr.CSS wrote: Please don't use CAPS like that as it only makes it look like your yelling...

-
- New Member
- Posts: 6
- Joined: Mon Apr 26, 2010 4:59 am
Re: Opening Multiple Store Locations will like stylesheet link per location.
It is one site with hardcoded html in through out the content.
Pages should have proper region in place of the East Texas that is currently in there.
All regions share same content. The only thing different is the
and the
Can I please hire someone to fix this.
Pages should have proper region in place of the East Texas that is currently in there.
All regions share same content. The only thing different is the
Code: Select all
</__body class="*region* ... plus other classes ...">
Code: Select all
<span class=local>*region*</span> scattered throughout the content[/b][/color]
-
- New Member
- Posts: 6
- Joined: Mon Apr 26, 2010 4:59 am
Re: Opening Multiple Store Locations will like stylesheet link per location.
Thanksm we have multiple liocations working fine with no content duplication.
This is how we fixed this issue.
.htaccess
plugins]$ cat function.initRegion.php
Not sure why these lines are commented out here
plugins]$ cat modifier.replaceLiteralTags.php
Here is the template
There is one remaining issue.
The and the shows up just fine in the template but does not show up at all when entered into the page title when adding a page. Instead the tag appears literally {$regionName} unparsed as if it was escaped out, which I am pretty sure did not happen. Not sure why the smarty variable tag is not parsing in the title.
This is a small thing and the client does not think this is an issue but it is bugging me a little.
This is how we fixed this issue.
.htaccess
Code: Select all
#AddType x-httpd-php .php .htm .html
AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php .php .htm .html
RewriteEngine on
RewriteBase /
# Rewrite Rule for www.allseasonswindows.com
RewriteRule ^([^/]+)/longview/(.*)$ $1/home-improvement/$2 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?allseasonswindows\.net [NC]
RewriteCond %{HTTP_HOST} ^allseasonswindows\.com [NC]
RewriteRule ^(.*)$ http://www.allseasonswindows.com/$1 [R=301,L]
redirect 301 /go/ http://www.allseasonswindows.com/east-texas/
redirect 301 /residential.html http://www.allseasonswindows.com/east-texas/
#old Rewrite Rule for regions
#RewriteCond %{SCRIPT_FILENAME} !-f
#RewriteCond %{SCRIPT_FILENAME} !-d
#RewriteRule ^([^/]+)(/(.*))?$ east-texas/test.html?r=$1 [QSA,NC,L]
#currently used Rewrite Rules
#sample rule : RewriteRule ^(<cssclassname-cum-slug>)(/(.*))?$ east-texas/$3?rcss=$1&rname=<url encoded region name. % sign has to be preceded by a backslash for it to work> [QSA,NC,L]
RewriteRule ^(longview)(/(.*))?$ east-texas/$3?rcss=$1&rname=longview&rmetro=East+Texas&rstate=Texas [QSA,NC,L]
RewriteRule ^(tyler)(/(.*))?$ east-texas/$3?rcss=$1&rname=tyler&rmetro=East+Texas&rstate=Texas [QSA,NC,L]
RewriteRule ^(shreveport)(/(.*))?$ east-texas/$3?rcss=$1&rname=shreveport&rmetro=shreveport+\%2F+bossier+city&rstate=Louisiana [QSA,NC,L]
RewriteRule ^(bossier-city)(/(.*))?$ east-texas/$3?rcss=$1&rname=bossier+city&rmetro=Western+Louisiana&rstate=Louisiana [QSA,NC,L]
RewriteRule ^(new-orleans)(/(.*))?$ east-texas/$3?rcss=$1&rname=new+orleans&rmetro=Gulf+Coast&rstate=Louisiana [QSA,NC,L]
RewriteRule ^(baton-rouge)(/(.*))?$ east-texas/$3?rcss=$1&rname=baton+rouge&rmetro=Gulf+Coast&rstate=Louisiana [QSA,NC,L]
RewriteRule ^(houston)(/(.*))?$ east-texas/$3?rcss=$1&rname=Houston&rmetro=Houston&rstate=Texas [QSA,NC,L]
RewriteRule ^(spring)(/(.*))?$ east-texas/$3?rcss=$1&rname=spring&rmetro=Houston&rstate=Texas [QSA,NC,L]
RewriteRule ^(conroe)(/(.*))?$ east-texas/$3?rcss=$1&rname=conroe&rmetro=Houston&rstate=Texas [QSA,NC,L]
RewriteRule ^(the-woodlands)(/(.*))?$ east-texas/$3?rcss=$1&rname=the+woodlands&rmetro=Houston&rstate=Texas [QSA,NC,L]
RewriteRule ^(austin)(/(.*))?$ east-texas/$3?rcss=$1&rname=austin&rmetro=Central+Texas&rstate=Texas [QSA,NC,L]
RewriteRule ^(san-antonio)(/(.*))?$ east-texas/$3?rcss=$1&rname=san+antonio&rmetro=Central+Texas&rstate=Texas [QSA,NC,L]
plugins]$ cat function.initRegion.php
Code: Select all
<?php
/*
* Smarty plugin
* -
* File: function.initRegion.php
* Type: function
* Name: initRegion
* Purpose: initialises regions array
* -
*/
function smarty_function_initRegion($params, &$smarty) {
$tmpval = urldecode($_GET["rcss"]);
$tmpval = ($tmpval == '')?"longview":$tmpval;
$smarty->assign("bodyClass", $tmpval);
$tmpval = ucwords(urldecode($_GET["rname"]));
$tmpval = ($tmpval == '')?"Longview":$tmpval;
$smarty->assign("regionName", $tmpval);
$tmpval = ucwords(urldecode($_GET["rmetro"]));
$tmpval = ($tmpval == '')?"East Texas":$tmpval;
$smarty->assign("regionMetro", $tmpval);
$tmpval = ucwords(urldecode($_GET["rstate"]));
$tmpval = ($tmpval == '')?"Texas":$tmpval;
$smarty->assign("regionState", $tmpval);
}
Not sure why these lines are commented out here
plugins]$ cat modifier.replaceLiteralTags.php
Code: Select all
<?php
/*
* Smarty plugin
* -
* File: modifier.replaceLiteralTags.php
* Type: modifier
* Name: replaceLiteralTags
* Purpose: replaces tags of the form {$varname} from CMSMS fields like title
* -
*/
function smarty_modifier_replaceLiteralTags($input) {
return preg_replace('/\{(\$[^\}]+)\}/', eval(1), $input);
//$smarty->assign("bodyClass", $tmpval);
//$smarty->assign("regionName", $tmpval);
//$smarty->assign("regionMetro", $tmpval);
//$smarty->assign("regionState", $tmpval);
}
?>
Here is the template
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/x html1-strict.dtd">
{initRegion}
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile='http://www.w3.org/2006/03/hcard'>
<title>{title} - {sitename} - {$regionName}</title>
{metadata}
{stylesheet}
<link type="text/css" href="/east-texas/scripts/ui/css/allseasons-brown/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<!--[if lt IE 7]>
{stylesheet name='allseasonsie'}
<![endif]-->
{* udtname *}
</head>
</__body class="{$bodyClass} {page_class}">
<div class="container_16">
<div id="header" class="grid_16 clearfix"> <a href="index.php"><img src="/{$bodyClass}/images/layout/logo.gif" width="299" height="73" alt="{$regionName} Windows and Doors" /></a> </div>
<div id="menu" class="grid_16 clearfix">
<!-- <img src="/east-texas/images/layout/top-menu.png" width="905" height="18" alt="{$regionName} Windows and Doors" usemap="#topmenu" /> -->
{menu template="css menu with region" number_of_levels='4'} </div>
<div id="page-wrapper" class="grid_16 clearfix">
<div id="sidebar" class="grid_4 alpha"><br />
<div class="nav">
<h4>Vinyl Windows</h4>
<ul>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/8400-series.html">8400 Series<span class="local"> Vinyl Windows in {$regionName}</span></a><br />($1,500 Energy Tax Credit)</li>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/140-series.html">140 Series Casement<span class="local"> Vinyl Windows in {$regionName}</span></a><br />($1,500 Energy Tax Credit)</li>
</ul>
<h4>Aluminum Windows</h4>
<ul>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/100-series.html">100 Series<span class="local"> Aluminum Windows in {$regionName}</span></a></li>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/200-series.html">200 Series<span class="local"> Aluminum Windows in {$regionName}</span></a></li>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/400-series.html">400 Series Thermal<span class="local"> Aluminum Windows in {$regionName}</span></a></li>
</ul>
<h4>Commercial Windows</h4>
<ul>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/400-series-commercial.html">400 Series Thermal<span class="local"> Commercial Windows in {$regionName}</span></a><br />
(C40 - C50)</li>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/400-series-louver.html">400 Series Thermal<span class="local"> Commercial Windows in {$regionName}</span></a><br />
(Integral Louver System)</li>
</ul>
<h4>Storm Windows</h4>
<ul>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/windows/4100-series.html">4100 Series<span class="local"> Storm Windows in {$regionName}</span></a><br />
(Storm Windows)</li>
</ul>
<h4>Doors</h4>
<ul>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/storm-doors.html">Storm Doors<span class="local"> in {$regionName}</span></a></li>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/entry-doors.html">Entry Doors<span class="local"> in {$regionName}</span></a></li>
<li><a href="http://allseasonswindows.com/{$bodyClass}/home-improvement/interior-doors.html">Interior Doors<span class="local"> in {$regionName}</span></a></li>
</ul>
<hr />
{search}
</div>
<div class="nav-bottom"> <a href="http://allseasonswindows.com/2009-taxcredit.pdf">2009 $1500 Stimulus Energy Tax Credit</a> </div>
<div class="nav-under">
<p></p>
</div>
<!-- end #sidebar -->
</div>
<div id="content-wrapper" class="grid_12 clearfix omega"> {* Start Breadcrumbs *}
<div id="breadcrumbs" class="">
<div>{breadcrumbs starttext='You are here' root='Home' delimiter='»'}</div>
</div>
{* End Breadcrumbs *}
<div id="slider">
<ul>
<li><a href="http://allseasonswindows.com/2009-taxcredit.pdf"><img src="/east-texas/images/layout/02.jpg" width="696" height="241" alt="2009 Energy Stimulus Tax Credit" /></a></li>
</ul>
</div>
<h1 class="title grid_12 clearfix omega">{$regionName} {title}</h1>
<div class="content grid_12 clearfix"> {content} </div>
<!-- end #content-wrapper -->
</div>
<div id="main-menu">{* menu template='Menu Icon Expand' *}</div>
<!-- end #page-wrapper -->
</div>
<div id="footer" class="grid_16 clearfix"> </div>
<div id="under-footer" class="grid_16 clearfix"> {global_content name='footer'} </div>
<!-- end .container_16 -->
</div>
<div id="page-bottom">
</div>
{literal}
<__script__ type="text/javascript" src="http://www.google.com/jsapi"></__script>
<__script__ type="text/javascript" src="/east-texas/js/jquery.js"></__script>
<__script__ type="text/javascript" src="/east-texas/js/simplegallery.js"></__script>
<__script__ type="text/javascript" src="/east-texas/js/scripts.js"></__script>
<__script__ type="text/javascript" src="/east-texas/scripts/ui/js/jquery-1.3.2.min.js"></__script>
<__script__ type="text/javascript" src="/east-texas/scripts/ui/js/jquery-ui-1.7.2.custom.min.js"></__script>
<__script__ type="text/javascript">
$(function(){
// Tabs
$('#tabs').tabs();
});
</__script>
<!--[if gte IE 5.5]>
<__script__ language="JavaScript" type="text/JavaScript">
$(document).ready(function(){
$("#navmenu li").hover(
function() { $(this).addClass("iehover"); },
function() { $(this).removeClass("iehover"); }
);});
</__script>
<![endif]-->
<!--[if IE 6]>
<__script__ type="text/javascript">
/*Load jQuery if not already loaded*/ if(typeof jQuery == 'undefined'){ document.write("<__script__ type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></"+"script>"); var __noconflict = true; }
var IE6UPDATE_OPTIONS = {
icons_path: "http://static.ie6update.com/hosted/ie6update/images/"
}
</__script>
<__script__ type="text/javascript" src="http://static.ie6update.com/hosted/ie6update/ie6update.js"></__script>
<![endif]-->
{/literal}
<__body>
</__html>
There is one remaining issue.
The
Code: Select all
{$regionName}
Code: Select all
{$bodyClass}
This is a small thing and the client does not think this is an issue but it is bugging me a little.
Re: Opening Multiple Store Locations will like stylesheet link per location.
Titles are set to be literal, meaning they print out as is, there is maybe a menu parameter used in the menu template that will let you change this behavior...