This tutorial illustrates the use of a header,body,and footer to explain arrays with hyperlinks programming. In particular the use of hyperlinks associated with an array and/or function shuffel for pictures order (Shuffel, Alphabetical, Reverse). Output Buffering(output control) allows you to write and execute your scripts as normal but send data to the web browser at selected times. The main benifit of the system is you can call the header(), setcookies(), and session_start() functions at nearly any spot in your script without concern for the headers already sent error message. At the conclusion of the script call the ob_end_flush or ob_end _clean to send the accumulated buffer to the browser.
Do Not Copy Code below. The tags contains white spaces and will not execute. Copy & Paste Code 08/08 Script Created by admin@inetmodel.com /* Tutorial script function_Shuffel__pictures_with_hyperLinks random generated. /*instructs the use of an array with the function shuffel with hyperlinks to pictures. // ob_start() eliminates any error problems with the pages header error message //output buffering allows you to structure your script in a more linear form ob_start(); ?> < html> < head> < ?php //Numbered pictures array used for the function shuffel. Pictures stored in the images folder $pictures = array('01.jpg','02.jpg','03.jpg','04.jpg','05.jpg', '06.jpg','07.jpg','08.jpg','09.jpg','10.jpg', '11.jpg','12.jpg','15.jpg','13.jpg','14.jpg', '16.jpg','17.jpg','18.jpg','19.jpg','20.jpg'); shuffle($pictures); ?> < /head> < body> < !--- end of header.inc ---!> < ?php #1.0.0 index.php //Sets page title and contains opening html, header, and body tags. $page_title='Tutorial_Array_HyperLink_Shuffel'; include('./header.inc'); ?> < Center> < table hieght=60% width=40%> < tr> //The number 6 represents the number of pictures returned. //This could be any number of images you want returned for( $i = 0; $i < 6; $i++) { echo '"< td align=center width = 60%>< a target="_blank" href="images/'; echo $pictures[ $i]; echo '" width="100" height= "73">< img src="images/'; echo $pictures[$i]; echo '" width= "100" height= "73">< /td>'; } ob_end_flush ?> < /tr> < /table> < font color=white size=3>New Images "Refresh Page" (F5) < /font>< /center>'; < !--- end of index.php ---!> < ?php #1.0.0 footer.inc //contains body and html closing tags. include('./footer.inc'); ?> |