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

Re: [PBML] Digest Number 1195

Expand Messages
  • Lori Eldridge
    Hi All, I m a web designer who is new to Perl. I ve read the first several chapters of Sam s learn Perl in 24 hours but I still don t understand how to write
    Message 1 of 1 , May 1, 2003
    View Source
    • 0 Attachment
      Hi All,

      I'm a web designer who is new to Perl. I've read the first several chapters of Sam's "learn Perl in 24 hours" but I still don't understand how to write an if-else yet.

      I've been installing a horse classifieds program and would like to change it a bit. The original program is set to bring up either a full image or a thumbprint in the ads but not both and we want a full image in the details page and a thumbprint on the headlines, if a picture has been submitted by the poster, instead of a static image of a camera. I was told I can change the code but could really use your help with the Perl.

      Here is the portion of the code set to bring up a static image (small camera gif) in the headlines:

      sub headlines_display

      --snip---

      if ($allow_photo_uploads eq "on") {

      $number = $fields[$index_of_db_id_number];
      $mm = "";

      for ($i = 1;$i <= $max_photo_uploads;$i++)
      {
      if ((-e "$upload_path/$section.$number.$i.gif") || (-e "$upload_path/$section.$number.$i.jpg")) {
      $mm = "on";
      print qq~<img src="$graphics_dir/smallcamera.gif" width=16 height=12 border=0 alt="small camera icon" align=middle>~;
      last; }
      }

      Here is the code for the details page which brings up a full image depending on which horse is being displayed. I need this code incorporated into the above code so it will use a thumbnail of the horse in question, if one is available, instead of a static image of a camera.

      sub long_display {

      print qq~
      <TABLE BORDER=0 cellpadding=2 CELLSPACING=1 WIDTH=460>
      <tr><td align=center>~;

      if ($allow_photo_uploads eq "on") {

      $number = $fields[$index_of_db_id_number];

      for ($i = 1;$i <= $max_photo_uploads;$i++)
      {
      if (-e "$upload_path/$section.$number.$i.gif") {
      if (($ad_photo_size eq "full") || ($form_data{'photo_size'} eq "full")) {
      &require_supporting_libraries (__FILE__, __LINE__, "$path/library/image-lib.pl");
      &imagesize("$upload_path/$section.$number.$i.gif");
      print qq~<img src="$photo_dir/$section.$number.$i.gif" width=$image_width height=$image_height alt="Photo for Ad $number"> ~;
      }
      elsif ($ad_photo_size eq "thumbnail") {
      print qq~<a href="$script_url?db=$form_data{'db'}&website=$form_data{'website'}&session_key=$session_key&search_and_display_db_button=on&results_format=long&db_id=$fields[$index_of_db_id_number]&query=retrieval&photo_size=full"><img src="$photo_dir/$section.$number.$i.gif" width=$thumbnail_size height=$thumbnail_size alt="Thumbnail photo for Ad $number"></a> ~;
      }
      elsif ($ad_photo_size eq "icon") {
      print qq~<a href="$script_url?db=$form_data{'db'}&website=$form_data{'website'}&session_key=$session_key&search_and_display_db_button=on&results_format=long&db_id=$fields[$index_of_db_id_number]&query=retrieval&photo_size=full"><img src="$graphics_dir/photo.gif" width=41 height=41 border=0 alt="photo icon"></a> ~;
      }
      else {
      print qq~~;

      --------snip-------

      I have not included the if-else statement for sound or video files, etc.

      Any advice would be appreciated.
      thanks
      Lori Eldridge
      www.loriswebs.com
    Your message has been successfully submitted and would be delivered to recipients shortly.