How to insert unique links into database generated pages

Discussion in 'PHP' started by metaxom, Mar 19, 2009.

  1. #1
    I have some php web sites where pages are generated from databases or grabbed remotely from external databases. The scripts have header and footer which are static but it is the same header on every page. I'm looking for a script that could let me insert unique links on different pages. Is that possible? Thanks
     
    metaxom, Mar 19, 2009 IP
  2. Devant

    Devant Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Could you be a bit more clear please? Let me see if I got correctly what you mean.

    You have a page, let's say Foo.php. But it is not always the same, since the content is generated via DBs. What you want is to be able to make a link that will point into the Foo.php with specific content?

    This would be easy by putting the specifications for the content in the URL, and retrieve it with $_GET. If I got it wrong, please, be more specific. :D
     
    Devant, Mar 19, 2009 IP
  3. metaxom

    metaxom Active Member

    Messages:
    881
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    78
    #3
    Thanks. Well yes, so if I have a page named halowars.php I would like to put a link to a halo fan site and if I have a page named fracturegame.php to put a link to shop where you can purchase fracture game and so on. But I don't want all these links to show on all pages in the header or footer but somewhere else in the page. I guess it would depend on how the script was made...
     
    metaxom, Mar 19, 2009 IP
  4. Devant

    Devant Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, as you guessed, the best solution is relative to the scripting you have done so far.

    Do you have something unique that identifies each page? For example, when a page is generated, a unique identifier is called from the DB.

    Or it is completely modular? For example, for page "foo", grab this data, and that right there, and the other one etc.

    In case you have a unique identifier, just make a table that stores the link for each page, and is called during page generation.

    In case you do not, your best call is to make a table as above, but define which page the user is visiting, by adding data to the URL, and retrieving it with GET.

    Does this help you? :D
     
    Devant, Mar 19, 2009 IP
  5. Devant

    Devant Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Based on your PM, where you practically said that the URL is different each time, you can use $_SERVER variables to identify what content to display, including links.
     
    Devant, Mar 19, 2009 IP