Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Location
    Edmonton
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Trying to make a "create-a-page" feature in a CMS...

    Hi there, to all up to the challenge:

    I have created my own little CMS in PHP. But there is one feature I really want to add.

    First off, I have it set up so that the client can log in, select a page from a list, and edit, and delete the entry.

    What I want to do is have a feature where a client can type in the name of a page into an form input box and when they hit create, it will create a new page. Essentially I want them to be able to enter the name, submit, and have a new table made in a mySQL database. But I have no idea where to start, I cant find any documentation on the net, mainly because I dont know where what to look for.

    If anybody has any assistance for me it would be greatly appreciated!
    http://www.ryanheinrichs.com - My Website

    http://callowcaper.blogspot.com - My Upcoming YouTube Mini-Series

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    lookup the fwrite and fopen file functions.

    eg.
    PHP Code:
    if (!file_exists($_GET[url] . '.php')){
    $file fopen($_GET[url] . '.php''w');
    fwrite($file'Hello world!'); 
    Last edited by Mwnciau; 08-22-2006 at 11:27 PM.

  • #3
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    r_plane
    quick question are you creating a new table for each page or a new record in a table for each page?
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #4
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Quote Originally Posted by musher
    r_plane
    quick question are you creating a new table for each page or a new record in a table for each page?
    If i were you I would suggest not stroring the page data in an sql, just use the fwrite function to create it. then only use a database to store the URL for use by and nav menus you may have.

  • #5
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by timgolding
    If i were you I would suggest not stroring the page data in an sql, just use the fwrite function to create it. then only use a database to store the URL for use by and nav menus you may have.
    timgolding/Mwnciau quick question guys, why not store page content in MySQL? I've been doing that for awhile now is there an advantage to storing it in a flat/txt file or dis-advantage to writing content to MySQL?
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #6
    New to the CF scene
    Join Date
    Dec 2005
    Location
    Edmonton
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ive found it easiest to make separate tables, but maybe because I dont entirely know how to do it any other way. If there are any good tut's on the net for this kind of stuff, I would love to take a look at them. Anybody know where to find an online source for all of this stuff?

    Thanks for everybodies input thus far. Its been muchos appreciated.
    http://www.ryanheinrichs.com - My Website

    http://callowcaper.blogspot.com - My Upcoming YouTube Mini-Series

  • #7
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Quote Originally Posted by musher View Post
    timgolding/Mwnciau quick question guys, why not store page content in MySQL? I've been doing that for awhile now is there an advantage to storing it in a flat/txt file or dis-advantage to writing content to MySQL?
    A web page should be stored as a web page. There is an advantage in executing it as you can include serverside scripts in the file. These codes could not easily be executed using echo commands.

    Also I generally only use SQL for data that requires fast access for multiple user across multiple records. In the case of a single web page i think the text file option is more feasable

    Having said that you could do it using SQL


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •