Support Forums


Go Back   68 Classifieds Forums > Help & Support > v4.1 Questions & Support

Notices

 
LinkBack Thread Tools Display Modes
Old 04-15-2009, 03:59 AM   #1
Member
 
 
Join Date: Jan 2009
Location: England
Posts: 42
Rep Power: 2
jason1971 is on a distinguished road
Default add {$city} to viewlisting.tpl title tag

Hi,

What i am looking to acheive is to create a page with a load of cities in, and when a city is clicked show the results of any listings within that city in the viewlistings.tpl. Whilst I can do this no problem, what I am struggling with is to get the city name to appear in the title tag. I have tried {$city} and no joy.

I would like it to appear in the rsults as something like:

<title>Second hand items for sale in cityname</title>


Is this possible does anybody know ?

Many Thanks for your time
__________________
v4.0.9 Hosted
jason1971 is offline   Reply With Quote
Old 04-15-2009, 06:53 AM   #2
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 714
Rep Power: 18
bowers01 is on a distinguished road
Default

put {debug} in the head section of layout.tpl and it will tell you what you can use.
Nick
__________________
Nick Bowers
68c v4.09 Developer
bowers01 is offline   Reply With Quote
Old 04-15-2009, 11:13 AM   #3
Member
 
 
Join Date: Jan 2009
Location: England
Posts: 42
Rep Power: 2
jason1971 is on a distinguished road
Default don the debug not sure what to do with the results tho

Hi there,
As suggested I have ran a debug in my layout.tpl and the results for the section I require are below, my issue now is how do I use the information to add to my <title> tag

I would like it to look something like <title>second hand items for sale in CITY NAME</title>.

I have tried just adding {$cities} but it come up as 'array', so I assume I have to do something using the information below. This is where I am stumpted, cos I have got a clue what to do with the information.

Any advise greatfully received, thanks Jason



{$cities} Array (17)
0 => Array (1)
city => "Aldershot"
1 => Array (1)
city => "arnold"
2 => Array (1)
city => "Ayrshire"
3 => Array (1)
city => "Birmingham"
4 => Array (1)
city => "Bristol"
5 => Array (1)
city => "gobowen"
6 => Array (1)
city => "Ilford"
7 => Array (1)
city => "london"
8 => Array (1)
city => "Market Drayton"
9 => Array (1)
city => "norwich"
10 => Array (1)
city => "oxford"
11 => Array (1)
city => "SWANSEA"
12 => Array (1)
city => "swimbridge barnstaple"
13 => Array (1)
city => "Tamworth"
14 => Array (1)
city => "Thornhill"
15 => Array (1)
city => "Wallasey"
16 => Array (1)
city => "Whitstable"


__________________
v4.0.9 Hosted
__________________
v4.0.9 Hosted
jason1971 is offline   Reply With Quote
Old 04-15-2009, 12:13 PM   #4
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,356
Rep Power: 41
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Quote:
Originally Posted by jason1971 View Post
Hi,

What i am looking to acheive is to create a page with a load of cities in, and when a city is clicked show the results of any listings within that city in the viewlistings.tpl. Whilst I can do this no problem, what I am struggling with is to get the city name to appear in the title tag. I have tried {$city} and no joy.

I would like it to appear in the rsults as something like:

<title>Second hand items for sale in cityname</title>


Is this possible does anybody know ?

Many Thanks for your time
The answer most likely lies within how you are able to do what you stated above, specifically " a city is clicked show the results of any listings within that city in the viewlistings.tpl." although I think you actually mean showlistings.tpl and not viewlistings which will only show one listings details.

The key is how are you linking to the showlistings page from the previous page. Is it a predefined search? If so, then it would be the "searchtext" variable that you are after which should then actually be visible in the url (unless you're using the SE friendly URLs module).

The variables that you are showing from the debug? Is that actually from the smarty panel on the page when you've already clicked on your city and are showing that cities ads? It doesn't seem like it. Try that if it isn't from that page.

Are the cities themselves categories? Perhaps a link to your site?
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 04-15-2009, 12:40 PM   #5
Member
 
 
Join Date: Jan 2009
Location: England
Posts: 42
Rep Power: 2
jason1971 is on a distinguished road
Default My mistake it is showlistings

Yes sorry it is showlisting.tpl (doh !)

What I have done is created a second searchlistings.php and a second showlistings.tpl to call and show the results in. (called seachlistings101.php and showlistings101.tpl )

I will then create a new page or section with a list of cities that is formed from users cities when registering. and call them by by the method below.

http://www.mywebsitename.com/searchresults101.php?searchtext=&city=Birmingham&s tate=&country=&Submit=Search">Birmingham</a>

Although this works fine in calling any items listing under birmingham it does not show the city name in the title tag.

Im not sure if what I am doing is correct (probably not). but its only getting the city name in the title tag thats bugging me, and after I did the debug and got that array info. That was it my mind went to jelly.

Id be most greatful if anybody could shed any light on when I need to do

Thanks Jason
__________________
v4.0.9 Hosted
jason1971 is offline   Reply With Quote
Old 04-15-2009, 01:55 PM   #6
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,356
Rep Power: 41
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Well, I can't say for sure, but it seems like you may be overcomplicating what you are trying to achieve (I have a tendency to do that as well at times). Wouldn't you get the same results if the the search was just for "Burmingham?" If so, then first of all, all the your links could simply be {$smarty.const.URL}/searchresults.php?city={$city} (that might be $u.city) and that should give you the same results. By doing it that way that also then means you can use the $paging variable in smarty.

That would allow you to have a dynamic title like this:
<title>{$sitetile} {$paging|replace:"city=":" "}</title>
OR
<title>Second hand items for sale in {$paging|replace:"city=":""}</title>
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 04-16-2009, 12:55 AM   #7
Member
 
 
Join Date: Jan 2009
Location: England
Posts: 42
Rep Power: 2
jason1971 is on a distinguished road
Default thank you Mike

Hi Mike,

Just want to say a BIG thank you for your help, with a bit of re-jigging it works great.

Jason
__________________
v4.0.9 Hosted
jason1971 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
User's city in header DGiscombe HTML, CSS, and Design Help 8 01-25-2009 09:30 AM
Customized meta 'title' for viewlisting frommarcq v4 Modules / Modifications 9 10-16-2008 05:45 AM
Pre-populated Town/City teg v3.1 Questions & Support 4 10-22-2007 12:49 PM
When not using Address or City Grebogreen v4 Questions & Support 2 07-05-2007 11:46 AM
Browse by Region/City djm v3.1 Modules & Modifications 1 09-11-2006 07:52 PM


All times are GMT -4. The time now is 01:20 AM.


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