Onyx Pro

Discussion in 'Theme Gallery' started by jbudin, Jun 30, 2011.

  1. jbudin Alkaline Developer

    Message Count:
    134
    Likes Received:
    0
    Home page:
    Onyx Pro is a great new sophisticated theme for photographers--especially if you're using Fotomoto because it has built-in support when you use the Alkaline Labs extension. It's also a great base for any other type of Web site.

    Demo
    http://onyxpro.alkalineapp.com/

    Price
    Free with any Alkaline license

    Screenshots

    [IMG]

    [IMG]

    [IMG]

    [IMG]

    Installation
    1. Download and install the theme, change your theme in Settings > Configuration.
    2. Let's edit your site to make it just like our demo:
    3. In index.php:

      PHP:
      // Let's find the latest published, public images, and have 6 on the first page and 12 on all subsequent pages
       
      $image_ids = new Find('images');
       
      $image_ids->page(null126);
       
      $image_ids->published();
       
      $image_ids->privacy('public');
       
      $image_ids->sort('image_published''DESC');
       
      $image_ids->find();
       
       
      // Let's load the images
       
      $images = new Image($image_ids);
       
      $images->formatTime('F j, Y');
       
      $images->getSizes();
       
      $images->addSequence('last'3);
       
      $images->hook();
       
       
      // Let's find the last 10 published posts
       
      $post_ids = new Find('posts');
       
      $post_ids->page(110);
       
      $post_ids->published();
       
      $post_ids->sort('post_published''DESC');
       
      $post_ids->find();
       
       
      // Let's load the posts
       
      $posts = new Post($post_ids);
       
      $posts->formatTime('j M Y');
       
      $posts->hook();
       
       
      // Let's find all our sets
       
      $set_ids = new Find('sets');
       
      $set_ids->find();
       
       
      // Let's load the sets
       
      $sets = new Set($set_ids);
       
      $sets->formatTime('F j, Y');
       
      $sets->getImages(1);
       
      $sets->images->getSizes();
       
      $sets->hook();
       
       
      $header = new Canvas;
       
      $header->load('header');
       
      $header->setTitle('');
       
      $header->display();
       
       
      $index = new Canvas;
       if(
      $image_ids->page == 1){
           
      $index->load('index');
           
      $index->loop($sets);
           
      $index->loop($images);
           
      $index->loop($posts);
       }
       else{
           
      $index->load('index_sub');
           
      $index->loop($images);
       }
       
      $index->assign('Page_Next'$image_ids->page_next);
       
      $index->assign('Page_Previous'$image_ids->page_previous);
       
      $index->assign('Page_Next_URI'$image_ids->page_next_uri);
       
      $index->assign('Page_Previous_URI'$image_ids->page_previous_uri);
       
      $index->assign('Page_Current'$image_ids->page);
       
      $index->assign('Page_Count'$image_ids->page_count);
       
      $index->display();
      The archive page is built from scratch. Let's open archive.php and change almost everything:

      PHP:
      // Keep everything, above the recordStat(); Let's cache the month list
       
      require_once(PATH CLASSES 'cache_lite/Lite.php');
       
      $cache = new Cache_Lite(array('cacheDir' => PATH CACHE'lifeTime' => 3600));
       
       
      // Not in cache? Let's make a new month list
       
      if(!$archive_list_html $cache->get('archive_list')){
           
      $image_ids = new Find('images');
           
      $image_ids->published();
           
      $image_ids->privacy('public');
           
      $image_ids->sort('image_published''ASC');
           
      $image_ids->find();
       
           
      $images = new Image($image_ids);
       
           
      $archive_list = array();
       
           foreach(
      $images->images as $image){
               
      $date date('Yn'strtotime($image['image_published']));
               
      $year substr($date04);
               
      $month substr($date4);
               if(empty(
      $archive_list[$year][$month])){
                   
      $archive_list[$year][$month] = 1;
               }
               else{
                   
      $archive_list[$year][$month]++;
               }
           }
       
           
      $archive_list_html '';
       
           foreach(
      $archive_list as $year => $array){
               
      $archive_list_html .= '<h3>' $year '</h3>';
               
      $archive_list_html .= '<ul>';
               foreach(
      $array as $month => $count){
                   
      $archive_list_html .= '<li><a href="' BASE 'archive.php?y=' $year '&m=' $month '">';
                   
      $month str_replace(array(1,2,3,4,5,6,7,8,9,10,11,12), array('Jan','Feb','Mar','Apr''May''Jun''July''Aug''Sept''Oct''Nov''Dec'), $month);
                   
      $archive_list_html .= $month ' ' $year '</a> <span class="quiet">(' $count ')</span></li>';
               }
               
      $archive_list_html .= '</ul>';
           }
       
           
      $cache->save($archive_list_html);
       }
       
       
      // Here's the standard archive.php code
       
      $year intval($_REQUEST['y']);
       
      $month intval($_REQUEST['m']);
       
      $day intval($_REQUEST['d']);
       
       
      $date $year;
       if(!empty(
      $month)){ $date .= '-' $month; }
       if(!empty(
      $day)){ $date .= '-' $day; }
       
       
      // If a month and year are selected, list those photos; otherwise, show the first 24 photos uploaded and no page buttons
       
      $image_ids = new Find('images');
       
      $image_ids->page(null24);
       
      $image_ids->published($date);
       
      $image_ids->privacy('public');
       
      $image_ids->sort('image_published''ASC');
       
      $image_ids->find();
       
       if(empty(
      $image_ids)){ $alkaline->addError('No images were found.''Try searching for the images you were seeking.'nullnull404); }
       
      // More of the same:
       
      $images = new Image($image_ids);
       
      $images->formatTime();
       
      $images->getSizes();
       
      $images->getEXIF();
       
      $images->getColorkey(95015);
       
      $images->getSets();
       
      $images->getTags();
       
      $images->getRights();
       
      $images->getPages();
       
      $images->getComments();
       
      $images->addSequence('medium_last'3);
       
      $images->hook();
       
      // More of the same:
       
      $header = new Canvas;
       
      $header->load('header');
       
      $header->setTitle('Archives');
       
      $header->display();
       
       
      $index = new Canvas;
       
      $index->load('archive');
       
      $index->assign('Archive_List'$archive_list_html);
       if(!empty(
      $date)){
           
      $index->assign('Page_Next'$image_ids->page_next);
           
      $index->assign('Page_Previous'$image_ids->page_previous);
           
      $index->assign('Page_Next_URI'$image_ids->page_next_uri);
           
      $index->assign('Page_Previous_URI'$image_ids->page_previous_uri);
           
      $index->assign('Page_Current'$image_ids->page);
           
      $index->assign('Page_Count'$image_ids->page_count);
       }
       
      $index->loop($images);
       
      $index->display(); // Keep your footer and the rest
    Extension support

    Attached Files: