[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/ -> dynamic_mopics.php (source)

   1  <?php
   2  /*

   3  $Id: dynamic_mopics.php 3 2006-05-27 04:59:07Z user $

   4  

   5    Dynamic MoPics version 3.000, built for osCommerce MS2

   6  

   7    Copyright 2006 osCMax2004-2005 Josh Dechant

   8  

   9    Released under the GNU General Public License

  10  

  11    ---------------------------------------------------

  12  

  13    osCMax Power E-Commerce

  14    http://oscdox.com

  15  

  16    Copyright 2006 osCMax

  17  

  18    Released under the GNU General Public License

  19  */
  20  
  21      // Backwards support for older osCommerce versions

  22      if (isset($product_info_values) && is_object($product_info_values)) {
  23          $product_info =& $product_info_values;
  24      }
  25  
  26      // Set the thumbnail basename; replaces "imagebase" in the user's pattern

  27      $image_base = mopics_get_imagebase($product_info['products_image'], DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR);
  28  
  29      // Set the large image's basename; replaces "imagebase" in the user's pattern

  30      $image_base_lg = mopics_get_imagebase($product_info['products_image'], DIR_WS_IMAGES . DYNAMIC_MOPICS_BIGIMAGES_DIR);
  31  
  32      // Get the counting method for the user's pattern (1,2,3; a,b,c; A,B,C; etc)

  33      $i = mopics_getmethod(DYNAMIC_MOPICS_PATTERN);
  34  
  35      // Set the search for the str_replace pattern search/replace

  36      $search = array('imagebase', mopics_match_pattern(DYNAMIC_MOPICS_PATTERN));
  37  
  38      // Set the initial replace for the str_replace pattern search/replace

  39      $replace = array($image_base, $i);
  40  
  41      // Are there any extra thumbnails for this product?

  42      if (mopics_file_exists(DIR_FS_CATALOG . str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN))) {
  43  
  44          $row = 0;
  45  
  46          // Loop until all of this product's thumbnails have been found and displayed…

  47          while ($image_ext = mopics_file_exists(DIR_FS_CATALOG .  str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN))) {
  48  
  49              $row++;
  50  
  51              // Set the thumbnail image for this loop

  52              $image = str_replace($search, $replace, DYNAMIC_MOPICS_PATTERN) . '.' . $image_ext;
  53  
  54              // Parse this thumbnail through tep_image for clients with javascript disabled

  55              $extraImageImage = tep_image($image, stripslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
  56              
  57              // Set large image replacement for the str_replace pattern search/replace

  58              $replace_lg = array($image_base_lg, $i);
  59  
  60              // Only link to the popup if a larger image exists

  61              if ($lg_image_ext = mopics_file_exists(DIR_FS_CATALOG . str_replace($search, $replace_lg, DYNAMIC_MOPICS_PATTERN), DYNAMIC_MOPICS_BIG_IMAGE_TYPES)) {
  62  
  63                  // Set the large image for this loop

  64                  $image_lg = str_replace($search, $replace_lg, DYNAMIC_MOPICS_PATTERN) . '.' . $lg_image_ext;
  65  
  66                  // Get the large image's size

  67                  $image_size = @getimagesize(DIR_FS_CATALOG . $image_lg);
  68  
  69                  // Set large image's URL for clients with javascript disabled

  70                  $extraImageURL = tep_href_link($image_lg);
  71  
  72                  // Parse this thumbnail through tep_image for clients with javascript enabled

  73                  $extraImagePopupImage = tep_image($image, addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
  74  
  75                  // Set the large image's popup width

  76                  $extraImagePopupWidth = ((int)$image_size[0] + 5);
  77  
  78                  // Set the large image's popup height

  79                  $extraImagePopupHeight = ((int)$image_size[1] + 30);
  80  
  81                  // Set the large image's popup URL text

  82                  $extraImageURLText = TEXT_CLICK_TO_ENLARGE;
  83  
  84                  // Set the large image's popup URL

  85                  $extraImagePopupURL = tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'] . '&pic=' . $i . '&type=' . $lg_image_ext);
  86  ?>
  87                  <div class="screenshots">
  88            <script language="javascript" type="text/javascript"><!--
  89              document.write('<a href="javascript:popupImage(\'<?php echo $extraImagePopupURL; ?>\',\'<?php echo $extraImagePopupHeight; ?>\',\'<?php echo $extraImagePopupWidth; ?>\');"><?php echo $extraImagePopupImage; ?><br /><span class="smallText"><?php echo $extraImageURLText; ?></span></a>');
  90            //--></script>

  91            <noscript>
  92              <a href="<?php echo $extraImageURL; ?>" target="_blank"><?php echo $extraImageImage; ?><br /><span class="smallText"><?php echo $extraImageURLText; ?></span></a>
  93            </noscript>
  94                  </div>
  95  <?php
  96              } else {
  97                  // No larger image found; Only display the thumbnail without a "click to enlarge" link

  98                  echo '<div class="screenshots">' . $extraImageImage . '</div>';
  99              }
 100  
 101              // Increase current count

 102              $i++;
 103  
 104              // Update the replace for the str_replace pattern search/replace for next image in the sequence

 105              $replace = array($image_base, $i);
 106          }
 107  
 108          // All thumbnails have been found and displayed; clear all of the CSS floats

 109          echo '<div class="clearScreenshots"><hr /></div>';
 110      } else {
 111          // No extra images found for this product

 112          echo '<p class="noScreenshots"><span class="smallText">' . TEXT_NO_MOPICS . '</span></p>';
 113      }
 114  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7