|
OnlineSchoolData
OnlineSchoolData |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Some tools shared below use php. Most servers support php. To check if your server supports php you can either contact your webmaster or use a text editor and create a file containing the following three lines: <?php The output should be similar to this. If you see the php banner indicating the version ID, you have access to php. Integrating php with html is simple. First, the pages must be named Also, you would want to make sure that Javascript is enabled. Check your browser's settings for that. Oh, by the way, use Mozilla Firefox as your default browser, especially if you are a Windows user. |
|
I wrote this simple script having the need to display images randomly. Works best if the images are the same aspect ratio.
In this case, the images were 100x150 pixes. You will need to adjust those two numbers to the size of your own images. To help you understand the code, remove the comments (//) to print debug statements. |
|
This implementation uses frames. It requires you to have images in this configuration: the full size image and its thumbnail. I use, irfanview, a nifty MS Windows program to create images in bulk mode. The thumbnails start with "thumb_" and can be of any type. You need to create three files: 1) the frame definition, 2) left.php, and 3) right.html. All three files will reside in the same directory as the images. The file left.php creates two named anchors for the top and the bottom of the left frame. The left.php file itself is created dynamically and its contents will be based the number of images it will find in the directory. The Frame Definition:
<FRAME SRC="right.html" NAME=right> The file left.php <?php
$counter = 0; $accumulator = "<html>\n<body>\n<div align=\"center\"><h2>Thumbnails</h2></div><a name=\"top\"></a>\n<p> </p>"; while (false !== ($file = readdir($handle))) {
$accumulator = $accumulator . "Go to: <a href=\"#top\">top</a>/<a href=\"#bottom\"<bottom</a</<a href=\"http://www.this.that.php\" target=\"_top\"<Home Page</a<\n"; $accumulator = $accumulator . "<p><a href=\"" . substr(stristr($file, '_'), 1) . "\" target=right><img src=\"" . $file . "\" alt=\"" . $file . "\" BORDER=0></a></p>"; $accumulator = $accumulator . "<a name=\"bottom\"></a>\n</body></html>"; closedir($handle); print $accumulator; The file right.php
</div> <p> </p><p> </p><p> </p> <div align="center"><h1>Click on a thumbnail to view the full image.</h1></div> |