1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Form that creates pages

Discussion in 'PHP' started by naopublic, Sep 17, 2012.

  1. #1
    I know you can create databases from a form. However, How would I go about creating a form that can create a folders and pages. I would like to request a simple example that I can work off from there.
     
    naopublic, Sep 17, 2012 IP
  2. pukhtoogle

    pukhtoogle Member

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    You can do this by placing any WYSIWYG editor rather then textarea, simply you have to declare a table fields

    Page ID
    Title
    Body
    Created Date
    Author

    Push the date from form to that table, and where you want you can display, also you can edit/delete/update the page with Page ID.
     
    pukhtoogle, Sep 18, 2012 IP
  3. Poppers

    Poppers Member

    Messages:
    61
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    28
    #3
    Are you talking about editing pages as pukhtoogle described? I got the impression you were talking about generating actual folders & files, if so here are examples:

    Make a folder:

    mkdir("/path/to/my/dir", 0700);

    Obviously you could replace the path with a variable which could be collection from a form, and the numbers are the folder permissions.

    Make a file:

    $fh = fopen($filename, 'w') or die("can't open file");
    fwrite($fh, $contents);
    fclose($fh);

    Set variables for filename and contents, obviously filename being the name of the file and contents being whats contained in it.
     
    Poppers, Sep 18, 2012 IP
  4. naopublic

    naopublic Member

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    ok, I understand the mkdir and I got it working. However, the part I that I am having difficulty with is the page creation.

    I am trying to create a form that once the information is submitted it creates the dir and than numerous other pages such as index.html pretty much launching a template site that the creator can go back and alter, but thats another story.
     
    naopublic, Sep 19, 2012 IP
  5. Poppers

    Poppers Member

    Messages:
    61
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    28
    #5
    What bit are you having trouble with, can I see your script so far?
     
    Poppers, Sep 19, 2012 IP
  6. alexkboorman

    alexkboorman Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #6
    second above, post your code maybe we can help. file creation is typically pretty straight forward in php.
     
    alexkboorman, Sep 23, 2012 IP