Support Forums

Old 12-18-2007, 03:20 AM   #1
CB
Senior Member
 
Join Date: May 2006
Posts: 391
Rep Power: 19
CB is on a distinguished road
Default State - Search Result SEO

Google has alerted me that duplicate titles are hindering proper indexing of my pages. I tracked the problem down to user that search by state, instead of showing the state the default title is shown. I’m using the code below and trying to add in the state, any ideas? Right now the second to last if/else is getting called. {$smarty.get.opt1}

Thanks in advance.


PHP Code:
{if $smarty.get.pg == 'featured'}
    
Featured Listings
{elseif $smarty.get.pg == 'new'}
    New 
Listings
{elseif $SCRIPT_NAME=='searchresults.php'}
    {if 
$storeTitle != ''}
        {
$storeTitle}
    {else}
        {
$smarty.get.opt1}
    {/if}
{else}
    {
$title}
{/if} 
CB is offline   Reply With Quote
Old 12-20-2007, 09:28 AM   #2
Moderator
 
 
Join Date: Mar 2006
Location: NJ/NYC Area
Posts: 2,163
Rep Power: 59
juven14 is a jewel in the rough
Default

Looks like they are choosing the default for you opt 1 extra field that is apparently ''.

Just expand you if else like this for other fields:

PHP Code:
{if $smarty.get.pg == 'featured'}
    
Featured Listings
{elseif $smarty.get.pg == 'new'}
    New 
Listings
{elseif $SCRIPT_NAME=='searchresults.php'}
    {if 
$storeTitle != ''}
        {
$storeTitle}
    {elseif 
$smarty.get.opt1 != ''}
        {
$smarty.get.opt1|escape}
    {elseif 
$smarty.get.state != ''}
        {
$smarty.get.state|escape}
    {elseif 
$smarty.get.city != ''}
        {
$smarty.get.city|escape}
    {else}
        {* 
Smarty CommentYou should also provide 
             something 
if all of the above failsotherwise 
             it won
't print anything since the last else for 
             title won'
t execute due to the page being searchresults.php *}
        {
$title}
    {/if}
{else}
    {
$title}
{/if} 
Of course the .state & .city should be exactly as the fields are named in the template. I think these are appropriate, but I haven't checked to see if they are not.

Also, it is wise to always escape user input especially when it is being printed out to the browser before it has been processed by the script. I've added the |escape modifier to your $_GET variables which is the same as htmlentities() I think. http://smarty.php.net/manual/en/lang...ier.escape.php

Here is the link for the $_GET variable for reference.
http://smarty.php.net/manual/en/lang...ty.request.php
__________________
TemplateCodes.com
juven14 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search result objelland v3.1 Questions & Support 11 12-18-2007 10:11 AM
Problems integrating search engine Avi8r v3.1 Questions & Support 1 05-11-2007 08:13 AM
Search: Only display cities when state has been chosen? wiredhat v3.1 Questions & Support 3 01-24-2007 04:35 PM
Each AD as a Search Result? garysr v3.1 Questions & Support 6 11-06-2006 03:46 AM
Search in Navigation bar marketingsolutions v3.1 Questions & Support 0 11-02-2006 12:10 PM


All times are GMT -4. The time now is 07:11 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0