Can PHP dynamically create a new page.

Discussion in 'PHP' started by Skinny, Mar 14, 2007.

  1. #1
    Okay I don't know if this can be done.

    But I'm currently programming a script that I want links to open in a new page.

    So lets say this is may page now.

    CODED HEADER

    DYNAMIC CONTENT

    LINK

    DYNAMIC CONTENT

    CODED FOOTER


    So what I want is that when someone clicks on the link a new page will be created which will look identical to the one I have before.

    CODED HEADER

    DYNAMIC CONTENT RELATING TO LINK

    CODED FOOTER

    Is this possible with php?

    Skinny
     
    Skinny, Mar 14, 2007 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,842
    Likes Received:
    4,543
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Skinny, that's what we do all the time. It's called content management.

    Or have I missed the point?

    check out www.php.net/include for how to call the headers and footers.

    you may end up with pages like

    stuff.php?show=elephants
    stuff.php?show=leopards

    or you can use .htaccess to hide the magic, but there's no big deal there these days.
     
    sarahk, Mar 14, 2007 IP
    klown likes this.
  3. mitchandre

    mitchandre Peon

    Messages:
    313
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This is the whole power and flexibility php provides.
     
    mitchandre, Mar 14, 2007 IP
  4. Ryandarin

    Ryandarin Peon

    Messages:
    66
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeah, what I do is use auto incrementing Id's for my mysql tables, and then just link to a page that recognizes the ID and only echo's out information based on that id, in the mysql query use WHERE id='$id' . <-- id being your mysql row and $id being the id of the link that was clicked on.
     
    Ryandarin, Mar 14, 2007 IP
  5. jitesh

    jitesh Peon

    Messages:
    81
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes You can use file functions.

    fopen()
    See also Appendix M, fclose(), fgets(), fread(), fwrite(), fsockopen(), file(), file_exists(), is_readable(), stream_set_timeout(), popen(), and stream_context_create().
     
    jitesh, Mar 14, 2007 IP
  6. hamidof

    hamidof Peon

    Messages:
    619
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You need a good PHP book;)
     
    hamidof, Mar 15, 2007 IP
  7. Skinny

    Skinny Peon

    Messages:
    1,864
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Wow.

    Okay. let's simplify this problem then. (Sorry I'm a php newb).

    So let's say that I have a hidden div with a unique id that I want displayed in a new page when I click a link.

    How would I go about doing this.

    i.e. lets say that the link is "elephants" and my hidden div contains a whole paragraph about elephants and it's id is "1".

    How can php display just that div in a new page?

    Skinny
     
    Skinny, Mar 25, 2007 IP