If this is your first visit, check our documentation. To post, register or login.
Forums / Templates, Stylesheets, Page Layout / specials and new items should be 3 pictures across, instead is 2, 1, 2, 1.

specials and new items should be 3 pictures across, instead is 2, 1, 2, 1.

Started by i_make_robots on 13 Apr 2013, 5:03 PM · Views: 649

Results 1 to 4 of 4
13 Apr 2013, 5:03 PM
#1
i_make_robots avatar

i_make_robots

New Zenner

Join Date:
Aug 2012
Posts:
46
Plugin Contributions:
0

specials and new items should be 3 pictures across, instead is 2, 1, 2, 1.

/includes/templates/[your template]/common/tpl_columnar_display.php

There are a ton of unnecessary "?><?php" pairs. That and the "\n" at the end of

echo '<div' . $r_params . '>' . $list_box_contents[$row][$col]['text'] .  '</div>'. "\n";

are breaking the 3-column display of monthly specials and new arrivals.
If you are experiencing similar problems, take out the extra junk and things should be better.

The meat of my tpl_columnar_display.php now looks like this:

if($title) echo $title; 

if (is_array($list_box_contents) > 0 ) {
  for($row=0;$row<sizeof($list_box_contents);$row++) {
    $box=$list_box_contents[$row];
    $params = "";
    //if (isset($box['params'])) $params .= ' ' . $box['params'];

    for($col=0;$col<sizeof($box);$col++) {
      $r_params = (isset($box[$col]['params'])) ? (' '.(string)$box[$col]['params']) : '';
      if (isset($box[$col]['text'])) {
        echo '<div' . $r_params . '>' . $box[$col]['text'] .  '</div>';
      }
    }
    echo "<br class='clearBoth' />";
  }
}

Thank you!

13 Apr 2013, 5:19 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: specials and new items should be 3 pictures across, instead is 2, 1, 2, 1.

Sounds great... but the vast majority of users will have no idea of what you are suggesting because 99% of them do not understand geek-speak.

It would be very helpful if you showed the FULL original code, and then the FULL replacement code, because most forum members will just work "parrot fashion" and will have absolutely no idea of what you are referring to when you say: take out the extra junk.

20 years a Zencart User

13 Apr 2013, 5:55 PM
#3
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: specials and new items should be 3 pictures across, instead is 2, 1, 2, 1.

If you would have asked you might have been directed to remove margins &/or padding in the stylesheet

Barring that, you could look at this code in /includes/modules/specials_index.php
and
/includes/modules/new_products.php

 $col_width = floor(100/$num_products_count); 

Zen-Venom Get Bitten

13 Apr 2013, 8:28 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: specials and new items should be 3 pictures across, instead is 2, 1, 2, 1.

Furthermore, it is certainly true that "unnecessary php pairs and \n" is NOT what's breaking the display of the page.

Adding a \n simply makes the HTML a bit more readable when you do a view source; it has no effect on how the browser renders the page.
Whether or not you terminate php processing at the end of every code line or leave it on for the entire block of code likewise has no effect; this is a stylistic choice. You might not like it, but it's not breaking the rendering of your page.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.