Results 1 to 11 of 11
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Location
    Tamborine Mountain Australia
    Posts
    248
    Hi there,

    I'm hoping someone here will be able to help me with this as I've been searching all over for an answer, but have yet to find a solution.

    What I'd like to be able to do is to make a page that has been searched for using a php have its own unique page title - for example if I searched for brand and category and wound up with the address below, what I would I need to do to make the title of the page brand category

    http://mysite.com/test.php?search=brand+category

    Does anyone know how I go about doing this?

  2. #2
    ABW Ambassador swampy_webber's Avatar
    Join Date
    January 18th, 2005
    Location
    West Virginia
    Posts
    698
    Tamborinegal,

    Maybe I'm misunderstanding but it seems like you could just do this -

    <?
    print "<Title>$search</Title>";
    ?>

    Maybe too simple but I think that'll work for ya.

    You can't depend on your eyes when your imagination is out of focus.
    --Mark Twain

    [This message was edited by Swampy_Webber on February 08, 2004 at 10:13 PM.]

  3. #3
    Full Member
    Join Date
    January 18th, 2005
    Posts
    270
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> below, what I would I need to do to make the title of the page brand category
    <HR></BLOCKQUOTE>

    If you rename your page structure to: /visitorsearch-brand-category.html then you can use a Rewriterule in your httpconf file to grab the 'brand-category' token, which you can use to your advantage.

    I 'think' that the php? query somehow lowers the impact of the page... my impression is that the se's won't rank the page as high as the .html style either.

    My $.02

    CodeJockey.

  4. #4
    Full Member
    Join Date
    January 18th, 2005
    Posts
    270
    The other option is to have two separate arrays. One for brand and one for category. If you already know what they've asked for in the php code then it's a simple matter of converting the php code to something in an array.

    You are kinda vague.

    CodeJockey.

    Edited to fix a tyop.

    [This message was edited by CodeJockey on February 08, 2004 at 10:36 PM.]

  5. #5
    ABW Ambassador swampy_webber's Avatar
    Join Date
    January 18th, 2005
    Location
    West Virginia
    Posts
    698
    I agree with CodeJockey. I was simply answering the question with the existing url. Re-write would certainly be a better solution. Thanks for pointing it out CodeJockey!

    You can't depend on your eyes when your imagination is out of focus.
    --Mark Twain

  6. #6
    Full Member
    Join Date
    January 18th, 2005
    Location
    Tamborine Mountain Australia
    Posts
    248
    Hi again,

    boy you guys are quick to reply.

    I'm kind of vague because I don't really know what I'm doing.

    I was just hoping that I could call my page the same thing as what was typed into the search box

    I tried the title idea you had swampy but it didn't work, but I could be missing something here. I put it in place of my title tag on my results page. Was that the right thing to do?

    Codejockey, I don't think I have access to my httpconf file - I do have mod rewrite enable so maybe I could do something in my htaccess file.

    I'm afraid the array idea has got me completely stumped.

  7. #7
    ABW Ambassador swampy_webber's Avatar
    Join Date
    January 18th, 2005
    Location
    West Virginia
    Posts
    698
    tamborine,

    Yes, my first suggestion should replace your existing TITLE section. Make sure you've included everything I listed from &lt;? to ?&gt;

    But, that said, yes you should be able to do the rewrite in .htaccess Actually that's where I do mine even though I have httpconf access. I kind of prefer it there (who knows why)

    If you can't get it working, PM me and I can send you a few notes.

    Good luck.

    You can't depend on your eyes when your imagination is out of focus.
    --Mark Twain

  8. #8
    Full Member
    Join Date
    January 18th, 2005
    Posts
    270
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> I'm kind of vague because I don't really know what I'm doing.

    I was just hoping that I could call my page the same thing as what was typed into the search box <HR></BLOCKQUOTE>

    Oh, that's o.k. I'm told that on a daily basis, but not in that exact same word order.

    If you stay with the ?search=brand+category, you have to do two things. The first is to get rid of the crap you don't need, and the second is to split the 'brand' and 'category'. I'm assuming you know how to hand the ? token.

    Get rid of the crap with a str_replace: $search_results = str_replace(".htm", "", $search_results);

    If you're using a "+" as a connector and it'll always be there, find out what it's position is in the $search_results string is. Use strpos:

    $mystring = 'brand+category';
    $findme = '+';
    $pos = strpos($mystring, $findme);

    Use the strlen command to find the length of $mystring: $string_length = strlen($mystring);

    Once you've done this, then use a substr to find the brand and category.

    $brand = substr("$mystring", 0, ($pos-1));
    $category = substr("$mystring", ($pos+1), ($string_length-($pos+1)));

    At this point you can then use the $brand and $category in your title:

    echo "&lt;html&gt;&lt;head&gt;&lt;title&gt;You searched our site for: ".$brand." and ".$category."&lt;/title&gt;";

    Off the top of my head and I didn't check it. But it should work and it'll give you the idea... couldn't think of how to get it simpler.

    CodeJockey.

  9. #9
    Full Member
    Join Date
    January 18th, 2005
    Location
    Tamborine Mountain Australia
    Posts
    248
    It worked!!

    Thank you, thank you, thank you swampy,

    I did paste in the entire code you gave me but I was browsing it in the results page instead of using my search page to send the query, so it looked like it wasn't working when it was

    I'm now trying to put the search words into the keywords meta tags on my page but it isn't working. Any ideas on this one?

    &lt;?
    print "&lt;meta name="keywords" content="$search"&gt;";
    ?&gt;

    Also, I'd love to do a mod rewrite to change my ugly php addresses and make them more search engine friendly, but I'm afraid I'll need a few pointers. I'll PM you about that to see if you have any ideas.

    Thank again

  10. #10
    Full Member
    Join Date
    January 18th, 2005
    Location
    Tamborine Mountain Australia
    Posts
    248
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by CodeJockey:
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR> I'm kind of vague because I don't really know what I'm doing.
    <HR></BLOCKQUOTE>

    Oh, that's o.k. I'm told that on a daily basis, but not in that exact same word order.
    <HR></BLOCKQUOTE>

    Well if you're told that you don't know what your doing because you're vague, I don't know where that leaves me.

    I'm afraid you've lost me with your solution.

    I must admit I haven't done much handcoding of php, I use dreamweaver and have been using their built in recordsets. I also bought a dreamweaver extension called Dynamic Search SQL Extension Suite by Tom Muck which is excellent http://www.basic-ultradev.com/exthelp/dynsearchphp/is the link if anyone who uses dreamweaver is interested in having a look at it.

    Thanks for your help codejockey - I'll file your solution away and have a look at it a bit further down the line, when I know more about what I am actually doing.

    Swampy's replacing of the title tag is all I need for now, but I'm sure I'll be needing more complex solutions later on, so thanks again.

  11. #11
    Full Member
    Join Date
    January 18th, 2005
    Location
    Tamborine Mountain Australia
    Posts
    248
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by tamborinegal:
    I'm now trying to put the search words into the keywords meta tags on my page but it isn't working. Any ideas on this one?

    &lt;?
    print "&lt;meta name="keywords" content="$search"&gt;";
    ?&gt;

    <HR></BLOCKQUOTE>

    I've worked it out - I've just used

    &lt;meta name="keywords" content="&lt;?php print "$search" ?&gt;"&gt;

    instead. I'm not sure if it is the proper way of doing it but it seems to work a treat.

  12. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Featured: Exact Match Titles or long titles
    By 9245af in forum Building Traffic, Newsletters & Advertising
    Replies: 18
    Last Post: January 5th, 2015, 06:38 AM
  2. Mod Rewrite and Dynamic Titles
    By barb45684 in forum Cusimano.com Scripts
    Replies: 6
    Last Post: June 27th, 2005, 02:29 PM
  3. Adwords Dynamic Ad Titles
    By Trust in forum Midnight Cafe'
    Replies: 14
    Last Post: August 20th, 2004, 12:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •