1
deka87
Assign a title to a search results page
  • 2008/11/5 14:05

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Hi, when you do some search query like "john" via http://freelancersupport.com/modules/profile/search.php, you get this page: http://freelancersupport.com/modules/profile/search.php?uname=john&&op=results

The question is how do I assign the query text "john" as a title of the results page (the http://freelancersupport.com/modules/profile/search.php?uname=t&&op=results one).

Like when you search for something (lets say "translation jobs") in google, the title of the results page (http://www.google.com/search?hl=en&q=translation+jobs&btnG=Google+Search&aq=f&oq=translation+job) is "Translation jobs - Google search".

Thanks in advance
Mind anchors

2
ghia
Re: Assign a title to a search results page
  • 2008/11/5 15:47

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Add a line in /modules/profile/search.php to assign the required title to the template eg.
$xoopsTpl->assign('xoops_pagetitle','Translation jobs - Google search');


3
deka87
Re: Assign a title to a search results page
  • 2008/11/5 16:12

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


I am afraid you got it wrong. I don't need a definite title for the search page. I need it to be variable and depend on the your query. Like if you search for JOBS teh title is JOBS, or if you search for TRANSLATION the title of the page is TRANSLATION.
Mind anchors

4
kerkyra
Re: Assign a title to a search results page
  • 2008/11/5 17:11

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


$xoopsTpl->assign('xoops_pagetitle',$_GET['uname']);
whttp://www.guidemap.gr - Beta is out...

5
iHackCode
Re: Assign a title to a search results page

modules/profile/search.php

add near line 172

171 $string $myts->addSlashes(trim($_REQUEST['uname']));
172 $xoopsTpl->assign('xoops_pagetitle',$myts->htmlSpecialChars($string ));//ADDED
173 switch ($_REQUEST['uname_match']) {
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

6
deka87
Re: Assign a title to a search results page
  • 2008/11/6 12:48

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Quote:
modules/profile/search.php add near line 172 171 $string = $myts->addSlashes(trim($_REQUEST['uname'])); 172 $xoopsTpl->assign('xoops_pagetitle',$myts->htmlSpecialChars($string ));//ADDED 173 switch ($_REQUEST['uname_match']) {


this didnt work . i guess it should be added somewhere but not between those lines. it doesnt affect the title. any suggestions?
Mind anchors

7
deka87
Re: Assign a title to a search results page
  • 2008/11/6 12:52

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


or maybe i'll try to simplify this. I need to make "Arabhic to English translators" title for this page http://freelancersupport.com/modules/profile/search.php?source_language=Arabic&target_language=English&op=results . how do I do that?
Mind anchors

8
trabis
Re: Assign a title to a search results page
  • 2008/11/6 12:55

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Try near the bottom just before this lines:
//hack
if (isset($_REQUEST['uname'])){
$string $myts->addSlashes(trim($_REQUEST['uname']));
$xoopsTpl->assign('xoops_pagetitle',$myts->htmlSpecialChars($string));
}

//end of hack
        
break;
}
include 
"footer.php";
?>

9
ghia
Re: Assign a title to a search results page
  • 2008/11/6 13:52

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


//hack
if (isset($_REQUEST['source_language']) && isset($_REQUEST['target_language'])){
$string $myts->addSlashes(trim($_REQUEST['source_language'])).' to '.$myts->addSlashes(trim($_REQUEST['target_language'])).' translators.';
$xoopsTpl->assign('xoops_pagetitle',$myts->htmlSpecialChars($string));
}

//end of hack
        
break;
}
include 
"footer.php";
?>

10
deka87
Re: Assign a title to a search results page
  • 2008/11/6 13:57

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Thanks alot, guys! You really helped me out. Titles are essential for seo so I hope this could be helpful for others too.
Mind anchors

Login

Who's Online

440 user(s) are online (321 user(s) are browsing Support Forums)


Members: 0


Guests: 440


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits