May 25, 201016 yr This follows on from a question that came up in a topic about getting the html contents of a file using php: Can php return a list of files in a directory, so that the pages that make up the site can be listed? I've used shell scripts, like bash on linux. Is there anything similar in php for navigating and new file creation/deletion ?
May 25, 201016 yr Author I'm just reading up on the glorious range of php functions that do this! opendir, readdir, and so on. Probably a good place to start.
May 25, 201016 yr Yes you can use scandir to populate an array with all files and sub directories within a directory.
May 25, 201016 yr This follows on from a question that came up in a topic about getting the html contents of a file using php: Can php return a list of files in a directory, so that the pages that make up the site can be listed? I've used shell scripts, like bash on linux. Is there anything similar in php for navigating and new file creation/deletion ? glob() is your friend.
May 25, 201016 yr Author I've had more success than I'd dared to hope for. I've got a form that works with ckEditor and sends results to a page which shows the user a preview and let's them save. However, when I try to save the results, the file that's created shows up like this in the browser: <html> <head> <title></title> </head> <body> <p> Type, slice, put pictures in to make a new page look good!</p> </body> </html> Which should be the source of the page, not what is displayed. When I look at the source code of the page it looks like this: <html> <head> <title></title> </head> <body> <p> Type, slice, put pictures in to make a new page look good!</p> </body> </html> There must be something I can do before writing to the new file created to make it save in an HTML friendly way.
May 25, 201016 yr Author Okay... I've got that working. The new files aren't saving the side-bar or footer, so that's what I'm looking at now.
Create an account or sign in to comment