[thelist] easy update facility

Kasimir K evolt at kasimir-k.fi
Wed Jul 20 11:33:30 CDT 2005


Emily Tarrant scribeva in 2005-07-19 21:36:
> As for PHP, I definitely have the desire, but at the moment not the 
> time!

Well, instead of first learning PHP and then doing the system you could 
do the other way around...

For example, displaying images in a directory is really easy, and all 
your client has to do is ftp the images to correct directory. If you 
have a page for images of Foo, you'd then have a file foo.php and in 
that something like this:

<html><body>
<h1>Images of Foo</h1>
<?php
// set variable $path
$path = 'path/to/foo/images/';
// set variable $dir to a directory handle for image directory
$dir = opendir($path);

// check the directory handle exists
if ($dir) {
	// read files from the directory handle
	// one by one, until no more files
	while (($file = readdir($dir)) !== false) {
		// files '.' and '..' are not images :-)
		if ($file != '.' && $file != '..') {
			// output html for each image
			echo "<img src='" . $path . $file . "'>";
		}
	}
}
?>
</body></html>

With texts it's even simpler. For example like this:

<?php
$textPath = 'path/to/texts/';
?>
<h1>First updateable text follows</h1>
<p>
<?php
include $textPath . 'first.txt';
?>
</p>

Your client just ftps a file called first.txt into the correct directory 
and the site is updated.

I'd say that implementing this kind of system would consume far less of 
your time than learning any ready made CMS or bloging system. And you 
being a TextPad girl this gives the most flexibility and control. E.g. 
you could just:
echo "<img src='" . $path . $file . "' class='fooImage'>";

And training your client to use a text editor and ftp is probably far 
easier that teaching them Contribute or Wordpress.

> Maybe I should get someone to read PHP to me 
> while I sleep so that when I wake up in the morning I miraculously know 
> it. Worth a try?

Definitely! And while you do that you can also learn PHP just by 
starting to use it.

.k


More information about the thelist mailing list