
 |
Created tutorials for setting up a site on Dreamweaver, WinSCP, and using PuTTY to change file permissions. All tutorials include PHP script that serves as the shell for creating a tutorial. To make a tutorial, you just include this script along with declaring two arrays, one for images and one for description of steps.
tutorial.php - shell for all tutorials, nothing would need to be changed here
<?php //What step number $step = isset($_GET["step"]) ? $_GET["step"] : 1; //If there is an array of images and an array of descriptions if(isset($imagesArray) && isset($descriptionArray)) { /*step navigation*/ echo "<p>"; /*previous button*/ if($step>1) echo "<a href=\"".$_SERVER["PHP_SELF"]."?step=".($step-1)."\">"; //If step is greater than 1, start the link for the previous button echo "<img src=\"buttons/previous"; //start the image tag if($step==1) echo "_disabled"; //If it is the first page, use the disabled button (greyed out) echo ".jpg\" alt=\"Previous\" />"; //finish the image tag if($step>1) echo "</a>"; //If the step is greater than 1, finish the link for the previous button echo " "; /*step numbers*/ //Start at one and go until the length of the images array minus 1 (array starts at 1) for ($num=1; $num<=count($imagesArray)-1; $num++) { if($step!=$num) echo "<a href=\"".$_SERVER["PHP_SELF"]."?step=$num\">"; //If the current step does not equal the number, start the link echo "<img src=\"buttons/$num"; //start the image tag if($step==$num) echo "_disabled"; //If the current step equals the number, use the disabled button (greyed out) echo ".jpg\" alt=\"$num\" />"; //finish the image tag if($step!=$num) echo "</a>"; //If the current step does not equal the number, finish the link echo " "; } /*next button*/ if($step<count($imagesArray)-1) echo "<a href=\"".$_SERVER["PHP_SELF"]."?step=".($step+1)."\">"; //If the current step is less than the length of the images array -1, start the link for the next button echo "<img src=\"buttons/next"; //start the image tag if($step==count($imagesArray)-1) echo "_disabled"; //If the current step is equal to the length of the images array -1, use the disabled button (greyed out) echo ".jpg\" alt=\"Next\" />"; //finish the image tag if($step<count($imagesArray)-1) echo "</a>"; //If the current step is less than the length of the images array -1, finish the link for the next butto\ echo "</p>"; /*The Image*/ echo "<h3>Step $step</h3>"; //heading for the step number echo "<p><span class=\"tutorialPic\"><a href=\"$folderName/fullSize/".$imagesArray[$step]."\"><img src=\"$folderName/".$imagesArray[$step]."\" alt=\"".$imagesArray[$step]."\" /></a></span>"; /*The Description*/ echo $descriptionArray[$step]."</p>"; } ?>
template.php - used to create new tutorials
<?php $pageName = "Dreamweaver Tutorial"; //Page title require_once "../../beforeContent.php"; //Don't change this setPageName($_SERVER["SCRIPT_FILENAME"]); //Don't change this $folderName = ""; //This is the directory name for which images for the particular tutorial are stored //Leave the first (0th) element blank, start at index of 1 $imagesArray = array(""); $imagesArray[1] = ""; $imagesArray[2] = ""; $descriptionArray = array(""); //Don't change this /*Use the following format to put in descriptions. The index number should correspond to the index number of the imagesArray*/ $descriptionArray[1] = ""; $descriptionArray[2] = ""; require_once "tutorial.php"; //Don't change this require_once "../../afterContent.php"; //Don't change this ?>
|