PHP Classes

File: examples/default.php

Recommend this page to a friend!
  Classes of Andy Loftus   Photo Album   examples/default.php   Download  
File: examples/default.php
Role: Example script
Content type: text/plain
Description: Let PhotoAlbum create the entire web page for you
Class: Photo Album
Display interactive photo album
Author: By
Last change: Fixed print statement so it works now.
Date: 17 years ago
Size: 1,708 bytes
 

Contents

Class file image Download
<?php
    $doc_root
= '/var/www/htdocs/pictures';
   
$web_root = '/pictures';
    require_once(
"$doc_root/php/PhotoAlbum.php");

   
// Create new photo album object
   
$album = new PhotoAlbum;

   
// Where to find required files for include
    // NOTE: All js and css files must be listed exactly as they would
    // be in their respective HTML tag (<link href=...> or
    // <script src=...>)
   
$album->LIGHTBOX_JS = "$web_root/js/lightbox.js";
   
$album->LIGHTBOX_CSS = "$web_root/css/lightbox.css";
   
$album->PROTOTYPE_JS = "$web_root/js/prototype.lite.js";
   
$album->MOO_FX_JS = "$web_root/js/moo.fx.js";
   
$album->MOO_FX_PACK_JS = "$web_root/js/moo.fx.pack.js";

   
// Add any optional HTML settings
    // This sets up the css file to be used for the layout. Either
    // modify the photoalbum.css file or link to a different one here.
   
$album->LINKS[] =
       
'<link rel="stylesheet" type="text/css" href="/crew/css/photoalbum.css" />';

   
// This is REQUIRED, it initializes all the moo.fx objects and
    // makes the whole thing work.
   
$album->SCRIPTS[] =
       
'<script type="text/javascript">' .
       
file_get_contents("$doc_root/js/photoalbum.js") .
       
'</script>';
   
   
// Create photo album
   
$rv = $album->create_album();
    if(
$rv !== TRUE)
    {
        exit(
'Error: The following problem occurred: '.$album->ERR);
    }

   
// Generate complete HTML page and print to screen.
   
$output = array();
   
$rv = $album->generate_full_page($output);
    if(
$rv !== TRUE)
    {
        exit(
'Error: The following problem occurred: '.$album->ERR);
    }
    print(
join('', $output));
?>