Results 1 to 7 of 7

 

Thread: dynamic <title> tag

  1. #1
    Self taught incompetent

    Status
    Offline
    Join Date
    Nov 2004
    Location
    North East UK
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts


    Hi all, sorry but this is probably going to be a stupid question but as a php/design noob its one I'm struggling with.

    on my dvd site, i have 2 pages .. searchTitles.php and fetchPrices.php which are passed variables e.g.. searchTitles.php?title=batman

    or fetchPrices.php?movie=mfno123546

    The issue is that at the moment i have several hundred instances of fetchPrices.php indexed by google, but the title and description of each page is the same. I want to have the dvd movie title in the <title> tag so i can make these pages different based on the content from the feed.

    anyone know how I can acheieve this?

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    401
    Thanks
    3
    Thanked 7 Times in 7 Posts
    it's quite easy really - in the first case if the title field contains evering you need then edit your 'searchtitles.php'
    where it says
    echo "<title>yoursitename</title>";
    you change it to
    echo "<title>$title - yoursitename</title>";
    (if it's not in an echo statement you'll probably need something like:
    <title><? echo $title ?> yoursitename</title>
    for the second one u will need to look up the title in your database based on the movie= code, and then put out the <title> tag after you know what it is.

  3. #3
    Self taught incompetent

    Status
    Offline
    Join Date
    Nov 2004
    Location
    North East UK
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks mate, will get to work on it. cheers

  4. #4
    lowndsy's Avatar
    Dark Prince

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,824
    Thanks
    7
    Thanked 44 Times in 33 Posts
    You need to move the html around in fetchprices.php to be displayed after the product title has been extracted from the xml. Then you can just put $dvdTitle in the title tags and it should work.

    You need to find something like this

    switch ($name) {
    case "TITLE":

    and put all the header info straight after that, from <html> all the way through to <body> and the basic page template. I'd move it into a seperate file and put it in fetchprices with a PHP include.
    It will slow the page down though - nothing will get written to the page until the xml file has beeen parsed.
    Last edited by lowndsy; 14-02-06 at 04:54 PM.

  5. #5
    Self taught incompetent

    Status
    Offline
    Join Date
    Nov 2004
    Location
    North East UK
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    with some great help from Lowndsy it is working. thanks all!

  6. #6
    Registered User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Netherlands
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could someone post the lines of code which need to be altered ? Thanks

    DutchRomano

  7. #7
    lowndsy's Avatar
    Dark Prince

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,824
    Thanks
    7
    Thanked 44 Times in 33 Posts
    I did it by editing MattyLambs code directly, and I don't actually use the medifusion dvd feed myself so I don't actually have the code to post here (and I don't want to publish Mattys code for obvious reasons). When I add the same changes to my game sites I'll post my page here.
    It's like I said in the post above - the xml is parsed in a big switch statement - with each case housing the action for the different types of data the xml could contain. You need to write the the page title to the screen after the data has been pulled from medifusion rather than having it right at the top of your code where it usually is...
    Just find the case statement marked TITLE and put all of your html, from the very first <HTML> all the way through to everything which appears before the products are displayed in there. I'd consolidate it into a seperate file but you don't have to.
    There are 2 switch statements - one containing the visual elements (that's the one you're looking for) and another one which just assigns some varibles to the right places - pretty hard to get them mixed up - just pick the one containing HTML.



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ASP dynamic to static pages
    By Leeky in forum Programming
    Replies: 3
    Last Post: 12-09-05, 09:23 PM
  2. creating link on dynamic text
    By ukyellowpage in forum Programming
    Replies: 3
    Last Post: 21-02-05, 11:28 PM
  3. Do dynamic pages use same bandwidth as static?
    By Elaine in forum Programming
    Replies: 4
    Last Post: 23-08-04, 11:52 AM
  4. Dynamic META Description
    By misscarolann in forum Programming
    Replies: 4
    Last Post: 08-08-03, 11:29 PM
  5. amazon add dynamic content
    By warncouk in forum Independent Programs
    Replies: 5
    Last Post: 26-03-02, 01:17 AM

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2