Grab The Title ? No ?

Discussion in 'HTML & Website Design' started by geekazoid, Jul 5, 2006.

  1. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #21
    That is a full working script that you can upload to your site. I tested it online and it works.

    You then need to look at the script and put the php bits into your page in the same locations they are above.
     
    mad4, Jul 6, 2006 IP
  2. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    Gary,

    I come here for advice which i beleive is what forums are set up for.
    Also i can not afford to hire someone being as im 16 and obviously unemployed.
    And i have a small understanding of html, css, php and javascript. Just the people here know Soooo much it goes over my head
     
    geekazoid, Jul 6, 2006 IP
  3. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    Mad4 do i put it in a php file and if so what do i name the file ?
     
    geekazoid, Jul 6, 2006 IP
  4. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #24
    You need to cut and past the different bits of it to every page on your site that you want the title and link to appear.
     
    mad4, Jul 6, 2006 IP
  5. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    geekazoid, Jul 6, 2006 IP
  6. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #26
    Post the entire code for that page.
     
    mad4, Jul 6, 2006 IP
  7. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    ok

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php



    ?>
    <html>
    <title>Title of the page</title>
    <body>
    <a href="http://www.geekazoid.co.uk<?php echo $_SERVER['REQUEST_URI']; ?>"><?php echo get_title_tag(); ?>
    </head>


    <body>
    <?php



    function get_title_tag(){
    $thesite="http://www.geekazoid.co.uk";
    $thepage=$_SERVER['REQUEST_URI'];
    $theurl="$thesite$thepage";
    $fp = fopen ("$theurl", 'r');
    while (! feof ($fp)){
    $contenu .= fgets ($fp, 1024);
    if (stristr($contenu, '<title>' )){
    break;
    }
    }
    if (eregi("<title>(.*)</title>", $contenu, $out)) {
    return $out[1];
    }
    else{
    return false;
    }
    }
    ?>

    </a>
    </body>
    </html>
    </body>
    </html>
     
    geekazoid, Jul 6, 2006 IP
  8. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #28
    <?php
    
    
    function get_title_tag(){
    $thesite="http://www.geekazoid.co.uk";
    $thepage=$_SERVER['REQUEST_URI'];
    $theurl="$thesite$thepage";
    $fp = fopen ("$theurl", 'r');
    while (! feof ($fp)){
    $contenu .= fgets ($fp, 1024);
    if (stristr($contenu, '<title>' )){
    break;
    }
    }
    if (eregi("<title>(.*)</title>", $contenu, $out)) {
    return $out[1];
    }
    else{
    return false;
    }
    }
    ?>
    <html>
    <head>
    <title>Title of the page</title>
    
    </head>
    
    
    <body>
    
    <a href="http://www.geekazoid.co.uk<?php echo $_SERVER['REQUEST_URI']; ?>"><?php echo get_title_tag(); ?>
    
    </body>
    </html>
    PHP:
    Also your html tags are pretty poorly structured!!!!!!!
     
    mad4, Jul 6, 2006 IP
  9. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #29
    all i did was open a new page in dreamweaver and paste you script i havent structured anything
     
    geekazoid, Jul 6, 2006 IP
  10. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #30
    OK, whatever. :rolleyes: Try the uploading the page I posted above.
     
    mad4, Jul 6, 2006 IP
  11. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #31
    geekazoid, Jul 6, 2006 IP
  12. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #32
    Don't paste the script into dreamweaver. Use notepad and save it as a php file and upload it to your site.
     
    mad4, Jul 6, 2006 IP
  13. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #33
    I have no problem with your condition, only with the apparent lack of motivation to learn the basic stuff from which all else is derived, and the apparent desire to have the answers just handed to you. It is imperative that you have a certain degree of competence in html and css. You should work your way through a few tutorials in javascript and php. You don't need to be able to create new scripts, but you should be able to work your way through something you are given. It is up to you to provide the basic understanding.

    Forums like this are most effective when folks needing help are given just enough info for them to get to the next step on their own, by study and further research.

    Tutorials in all these disciplines are available on the web. Google is your friend. As your level of basic understanding rises, the advice you're given will be more and more valuable to you.

    cheers,

    gary
     
    kk5st, Jul 6, 2006 IP