Add This Game To Your Website

Discussion in 'HTML & Website Design' started by geekazoid, Jun 29, 2006.

  1. #1
    On my games website i have a line of text under each of my games saying add this game to your website and its the script of a link to the website

    for ezample

    <a href="http://www.mygamespage.co.uk/GamesPage/Action/One-I.php">One I</a>

    i was wondering is there a way that instead of having to edit the line each page when putting in new games is there a way i can imput the same line into all the pages and it will change to match the page... Something like

    <a href="PAGE-URL-CAPTURE">PAGE-TITLE-CAPTURE </a>

    thanx peeps
     
    geekazoid, Jun 29, 2006 IP
  2. PFCritics

    PFCritics Peon

    Messages:
    107
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not the greatest with PHP, but if your files end in .php, you could insert something like this on your pages:

    <a href="http://www.mygamespage.co.uk<?php echo $_SERVER['REQUEST_URI']; ?>">Add this Game to Your Page!</a>

    And it'll fetch the end part of the URL depending on the page...
     
    PFCritics, Jun 29, 2006 IP
  3. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Cool, Thats just what i was looking for, But i would like the "add this game to your page " part to be the title of the page ? Would this be possible too ?
     
    geekazoid, Jun 29, 2006 IP
  4. brian394

    brian394 Well-Known Member

    Messages:
    226
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #4
    You would have to put the title of your page in a php variable like so...

    <?php
    $page_title = "This is the title of my page";
    ?>

    somewhere up near the top of your page and then use it in both places like so...

    <title><?php echo $page_title; ?></title>

    and

    <a href="http://www.mygamespage.co.uk<?php echo $_SERVER['REQUEST_URI']; ?>"><?php echo $page_title; ?></a>
     
    brian394, Jul 1, 2006 IP
  5. sundaybrew

    sundaybrew Numerati

    Messages:
    7,294
    Likes Received:
    1,260
    Best Answers:
    0
    Trophy Points:
    560
    #5
    what arcade script are you using?
     
    sundaybrew, Jul 1, 2006 IP
  6. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    but wouldnt i have to change that title php for everypage ? Where as what im looking for is just a line of code that i can paste into everypage.
     
    geekazoid, Jul 2, 2006 IP
  7. ahref

    ahref Well-Known Member

    Messages:
    1,123
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    170
    #7
    I think it is not possible to pick up title unless it is stored in some php variable.
     
    ahref, Jul 2, 2006 IP
  8. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    There is no way to graph the title, Isnt there some script that looks at the meta tag ?
     
    geekazoid, Jul 2, 2006 IP
  9. geekazoid

    geekazoid Peon

    Messages:
    208
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    OK so how do you store the title in a php variable ?
     
    geekazoid, Jul 10, 2006 IP
  10. terryuk

    terryuk Notable Member

    Messages:
    3,962
    Likes Received:
    319
    Best Answers:
    0
    Trophy Points:
    255
    #10
    Don't you have gamename in a variable from mySQL? You could put <title><?php echo("You are now playing $gamename"); ?></title> anywhere in the page
     
    terryuk, Jul 12, 2006 IP