?
Solved

Why do my face gfx display in one long column instead of rows and columns?

Posted on 2006-06-01
5
Medium Priority
?
204 Views
Last Modified: 2006-11-18
<?php
/******************************************************************************
* Places images from a group of faces into rows and column for display on the *
* website. First checks to see if the file exists on the FTP server before    *
* displaying it. If it does not, a place holder image is displayed.           *
******************************************************************************/

$faces_array = array();

$path_to_pics = 'images/faces/'; // path to the pictures folder

/******************************************************************************
* This switch sets the correct number range for the category requested        *
******************************************************************************/
switch($_GET['f_type']) {
  case "babies":
  $first_pic_num = 1000;
  $last_pic_num = 1831;
  break;
 
  case "girls":
  $first_pic_num = 5000;
  $last_pic_num = 5762;
  break;

  case "boys":
  $first_pic_num = 4000;
  $last_pic_num = 4756;
  break;
 
  case "women":
  $first_pic_num = 3000;
  $last_pic_num = 3938;
  break;
 
  case "men":
  $first_pic_num = 2000;
  $last_pic_num = 2971;
  break;

  case "pets":
  $first_pic_num = 6000;
  $last_pic_num = 6581;
  break;
}

/******************************************************************************
* Create the "back" link to return to the order form if the user got to the   *
* faces page from the order form. If the user got to the faces page from some *
* place else, do not display the back link.                                   *
******************************************************************************/
if(isset($_GET['ordering'])) {
  //$back_url = $_SERVER['HTTP_REFERER']; not using in favor of closing pop-up window

  $back_link =<<<BACKLINK
  <div style="margin-bottom:10px;text-align:center;font-size:16px;font-weight:bold;clear:left">
  Write down the number of the face you want to use. Then
  <a href="#" onclick="javascript:window.close();">Close This Window</a> and continue your order.
  </div>
BACKLINK;

  print ("$back_link");
}

/******************************************************************************
* Loops through the all of the faces in the range set in the above switch     *
* group. Creates an image tag for each image and also prints the image's      *
* number.                                                                     *
******************************************************************************/
for($i = $first_pic_num; $i <= $last_pic_num; $i++) {
      if(file_exists($path_to_pics . $i . '.gif')) {
            print ("<div class='face_and_num'>");
            print ("<img src='" . $path_to_pics . $i . ".gif" . "' alt='Face #" . $i . "' width='72px' height='72px' /><br />");
            print ("$i");
            print ("</div>");
      }
      else {
            
      }
}
if(isset($_GET['ordering'])) {
  print ("$back_link");
}
?></td>
              </tr>
          </table>
        <!-- InstanceEndEditable --></td><td>&nbsp;</td>
        <td rowspan="3" valign="top" bgcolor="#FFFFFF"><div align="center"><span class="body style5">Best viewed with:</span><img src="/images/ie_6_v06.gif" alt="IE 6 logo" width="91" height="34" /></div></td>
      </tr>
     
     
      <tr>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        </tr>
      <tr>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        <td bgcolor="#FFFFFF">&nbsp;</td>
        </tr>
      <tr>
        <td colspan="11" bgcolor="#8CC63F"><table width="100%" border="0" align="center" cellpadding="5" cellspacing="2">
          <tr>
            <td width="35%" valign="top" class="footer"><a href="hl_conditions_of_use.php">Conditions of Use</a>| Privacy Policy
              | <a href="http://www.chasmcommunications.com">Site Design</a> </td>
            <td width="31%" valign="top" class="footer"><div align="center" class="footerwhite style1">We Proudly Accept: <br />
              <table width="56%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="48%"><div align="center"><img src="images/visa_logo.gif" width="53" height="34" /></div></td>
                  <td width="52%"><div align="center"><img src="images/mc_logo.gif" width="55" height="34" /></div></td>
                </tr>
              </table>
            </div></td>
            <td width="34%" valign="top" class="footer"><div align="right" class="footerwhite style1"><span class="style2">&copy; 2005-2006.
              Happy Labels. All Rights Reserved.</span></div></td>
          </tr>
        </table></td>
        </tr>
    </table>
    </td>
  </tr>
</table>
<table width="805" border="0" align="center" cellpadding="4" cellspacing="4">
  <tr>
    <td colspan="2"><div align="center" class="linksbold"><a href="/about.php">About
          Us</a> | <a href="/fundraisers/default.html">Fundraisers</a> | <a href="/homebusiness/index.php">At-Home
          Business</a> | <a href="/faq.php">FAQs</a> | <a href="/contact.php">Contact
      Us</a> </div></td>
  </tr>
  <tr>
    <td width="319" valign="top">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
0
Comment
Question by:happylabels
  • 3
  • 2
5 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 16807934
You have each image in a <div>, which by default is a block level element, so you get an automatic line break after each.  Define a css style for the face_and_num class using "float: left;"
0
 

Author Comment

by:happylabels
ID: 16808042
This is the location of one of the pages the problem exists on: http://www.myhappylabels.com/faces.php?f_type=babies 

This is the css:
div.accessory {
      text-align: center;      
}

img.accessory {
      vertical-align: middle;
}

.accessory_name {
      font-size: 150%;
      font-weight: bold;
      margin: 0px 3px 0px 3px;
}

.face_and_num {
      float: left;
      text-align: center;
}

I don't know how to change the div tags, could you please send me a fixed version of the code. I am not sure the problem is in the php code or perhaps elsewhere. Thank you, Sylvia :)
0
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 16808125
Those styles are not included or linked on that page.
0
 
LVL 33

Accepted Solution

by:
snoyes_jw earned 2000 total points
ID: 16808139
As a shot in the dark, I'd guess you have a products.css and an accessories.css, and you've linked to the first on that page when you wanted the second.
0
 

Author Comment

by:happylabels
ID: 16808666
Thanks, that led me to the answer i needed. I had created a template page and it did not have the faces.css in it. i added that line of code and it worked...Eureka, and thanks again for your help, Sylvia :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question