Loading ...
Sorry, an error occurred while loading the content.

6861Re: photo box

Expand Messages
  • cosmico81
    Nov 23, 2006
    • 0 Attachment
      I have written a php code that make photobox dynamic by the use of PHP.

      this script should be included in the head of your html/php document.
      It needs a script (i've called it gallery.js) with the code of the
      photobox and the word LISTA_IMG instead of the static list of photoes.
      (it use two other files: lista_img with the list of image, with path,
      one for line and lista_caption with the list in the same order of
      capiton):

      <?php
      echo "<script>";
      $replacement="";
      $handle = fopen("collection/lista_img", "r");
      $handle2 = fopen("collectiom/lista_caption", "r");
      while (!feof($handle) && !feof($handle2)) {
      $buffer1=fgets($handle, 4096);
      $buffer2=fgets($handle2, 4096);
      $replacement.=
      "{src:\"http://www.your-site.it/".trim($buffer1)."\",caption:\"".trim($buffer2)."\"}";
      if(!feof($handle)) {
      $replacement.= ",";
      }
      }

      $fg= fopen("gallery.js", "r");
      while (!feof($fg)) {
      $stringa=fgets($fg, 4096);
      //echo $stringa;
      echo preg_replace("|LISTA_IMG|", $replacement, $stringa);
      }
      fclose($fg);
      fclose($handle);
      fclose($handle2);
      echo"</script>";
      ?>



      --- In ydn-javascript@yahoogroups.com, "Steven Peterson"
      <peterson@...> wrote:
      >
      > Priya,
      >
      >
      >
      > The PhotoBox is only a simple example. You can modify the code to
      make them
      > dynamic in whatever way you'd like, but that functionality isn't built
      > directly into the class. If you create a more complex version of
      PhotoBox,
      > please feel free to share it with the community!
      >
      >
      >
      > Thanks!
      >
      > Steven Peterson
      >
      > Web Developer, Platform Engineering
      >
      > Yahoo!
      >
      >
      >
      >
      >
      >
      >
      > From: ydn-javascript@yahoogroups.com
      [mailto:ydn-javascript@yahoogroups.com]
      > On Behalf Of priya_806
      > Sent: Tuesday, August 01, 2006 2:22 PM
      > To: ydn-javascript@yahoogroups.com
      > Subject: [ydn-javascript] photo box
      >
      >
      >
      > Hi
      >
      > I need to display the photos as shown in the Photo Box example,
      > but in example, the url of photos are hardcoded...
      >
      > my question is how can we set the url of photos dynamically,which
      > picks the photo from database depending on the photoid?
      >
      > Any suggestions please
      >
      > Thanks
      > Priya
      >
    • Show all 10 messages in this topic