saadsalman Posted February 16, 2010 Share Posted February 16, 2010 Hi, I need to have different page titles for different groups in my shopping cart instead of the default "Company Name - Shopping Cart" as shown: "Company Name - Shared Web Hosting" for http://www.mysite.com/cart.php?gid=1 "Company Name - Reseller Hosting" for http://www.mysite.com/cart.php?gid=2 "Company Name - Anything Else" for http://www.mysite.com/cart.php?gid=3 Anyone already done with this? Is that even possible? Regards 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 16, 2010 Share Posted February 16, 2010 Hi, I need to have different page titles for different groups in my shopping cart instead of the default "Company Name - Shopping Cart" as shown: "Company Name - Shared Web Hosting" for http://www.mysite.com/cart.php?gid=1 "Company Name - Reseller Hosting" for http://www.mysite.com/cart.php?gid=2 "Company Name - Anything Else" for http://www.mysite.com/cart.php?gid=3 Anyone already done with this? Is that even possible? Regards By default; no but the page title is defined in the template files so it is possible to do using the header.tpl file. Put this in top of your header.tpl: {php} if(preg_match('/^[0-9]{1,}$/', $_GET['gid']) AND preg_match("/cart.php/", $_SERVER["SCRIPT_NAME"])) { $result = select_query("tblproductgroups","name",array("id" => $_GET['gid'])); $data = mysql_fetch_array($result); $this->assign("pagecat", $data['name']); } {/php} And replace the <title> line with: <title>{$companyname} - {if $pagecat}{$pagecat}{else}{$pagetitle}{if $kbarticle.title} - {$kbarticle.title}{/if}{/if}</title> 0 Quote Link to comment Share on other sites More sharing options...
saadsalman Posted February 16, 2010 Author Share Posted February 16, 2010 Worked like a charm! God bless you buddy! 0 Quote Link to comment Share on other sites More sharing options...
NiGh10GaLe Posted November 12, 2022 Share Posted November 12, 2022 The code is not working for me 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.