herghost Posted July 27, 2008 Share Posted July 27, 2008 I am relatively new to PHP and I have a project in my mind, but I unsure how difficult it would be to create. Basically I want to write a script that would allow a user to click on a link and add a html page to a the website. Would I be better off calling in a professional script writer or do you think this is something that would be manageable given that my PHP skills advance quickly? Thanks for your advice Link to comment https://forums.phpfreaks.com/topic/116862-how-hard-would-this-be/ Share on other sites More sharing options...
Attila Posted July 27, 2008 Share Posted July 27, 2008 It will be fairly easy it depends on how you plan on saving the link. Is it just a one time link or is it going to be saved in a database to be displayed with other links in the database. More details would help as to how you want to do it. Link to comment https://forums.phpfreaks.com/topic/116862-how-hard-would-this-be/#findComment-600925 Share on other sites More sharing options...
herghost Posted July 27, 2008 Author Share Posted July 27, 2008 the link would be saved and displayed in a list of created pages, the user could then login and edit the page etc, basically like creating a mini page that would then be placed in a directory, with say, the top 10 pages linked from the homepage, and then any others would appear in categories. Thanks Link to comment https://forums.phpfreaks.com/topic/116862-how-hard-would-this-be/#findComment-600928 Share on other sites More sharing options...
Attila Posted July 27, 2008 Share Posted July 27, 2008 This is code from http://us2.php.net/manual/en/function.fwrite.php I perfer functions so I put it into a function for you if needed: <?php function writefile($variablename) //$variablename is the name of your variable from the input field. { $filename = 'yourfilenam.txt'; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { //if 1 // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } } ?> Link to comment https://forums.phpfreaks.com/topic/116862-how-hard-would-this-be/#findComment-600938 Share on other sites More sharing options...
herghost Posted July 27, 2008 Author Share Posted July 27, 2008 Thanks for this, your time is much appreciated, I think I am going to approach it from a different angle and use an open source wysiwyg online editor, like the one used to post threads on here and see if I can adapt it to create a new page instead of a thread in a forum etc. Thanks once again for your input Link to comment https://forums.phpfreaks.com/topic/116862-how-hard-would-this-be/#findComment-600969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.