Jump to content

How hard would this be?


herghost

Recommended Posts

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

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

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";
}

}
?> 

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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.