0
Welcome Guest! Login
0 items Join Now

Using div classes in a module php file?

  • Using div classes in a module php file?

    Posted 18 years 4 weeks ago
    • I have a module that I am trying to style with css, and I just can't seem to get it right. I setup a module class suffix for it, then put the code I wanted for the styling into my template_css.css file, and that is working fine. Now here comes the tricky part! There is text and an image in the module, and their alignment looks horrible! because of the height of the image, and the text aligning to the bottom of the image, it just looks wrong. So I need to get the text to basically be at the center height of the image..and to do this, I need to set up 2 div classes, one for the text and one for the image. This way I can position the text and the image individually. Problem is, I can't figure out where to put the div class= statements in the modules php file. Here is my suffix css coding:
      div.moduletable_cart {
      height: 35px;
      color: #fff;
      padding: 0px 5px 5px 8px;
      margin: -6px 5px 15px 0px;
      }
       
      .cartmsg {
      height: 35px;
      color: #fff;
      padding: 0px 5px 5px 8px;
      margin: -24px 26px 15px 0px;
      }
       
      .cartmsg2 {
      float: right;
      height: 35px;
      color: #fff;
      margin: -24px 40px 0px 0px;
      }
       
       
      div.moduletable_cart a.mainlevel:link,
      div.moduletable_cart a.mainlevel:visited {
          background: none;
          border-bottom: 0px solid #F5F5F5;
          color: #333;
      }


      So, as you can see, my module class suffix is _cart, and then I have a div class= cartmsg for the text and a div class= cartmsg2 for the image. On cartmsg I gave it 15px on the bottom margin and that will raise it up to where I need it in proportion with the image. Problem is, I haven't been able to place the div class statements anywhere in the php file and have them work:( Here is the php file for the module:
      <?php
      defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
      /**
      * VirtueMart MiniCart Module
      *
      * @version $Id: mod_virtuemart_cart.php,v 1.1 2005/09/29 20:02:56 soeren_nb Exp $
      * @package VirtueMart
      * @subpackage modules
      *
      * @copyright (C) 2004 Soeren Eberhardt
      * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
      * VirtueMart is Free Software.
      * VirtueMart comes with absolute no warranty.
      *
      * http://www.virtuemart.net
      */
       
      /* Load the virtuemart main parse code */
      require_once( $mosConfig_absolute_path.'/components/com_virtuemart/virtuemart_parser.php' );
       
      global $VM_LANG, $sess, $mm_action_url;
      $cart = $_SESSION['cart'];
       
       
      ?><table width="100%">
      &nbsp; &nbsp; &nbsp; &nbsp; <tr>
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <td><?php $sc_quantity = $params->get( 'sc_quantity' );
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sc_name = $params->get( 'sc_name' );
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sc_attrib = $params->get( 'sc_attrib' );
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sc_price = $params->get( 'sc_price' );
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sc_show_empty = $params->get( 'sc_show_empty');
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $sc_enable_empty = $params->get( 'sc_enable_empty');
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; include (PAGEPATH.'shop.basket_short.php') ?></td>
      &nbsp; &nbsp; &nbsp; &nbsp; </tr>
      &nbsp; &nbsp; &nbsp; &nbsp; <?php
      &nbsp; &nbsp; &nbsp; &nbsp; if ($cart["idx"] != 0) {
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $html = '<tr><td><div align="center">';
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $html .= '<a class="showbutton" href="'.$sess->url($mm_action_url."index.php?page=shop.cart").'"> ';
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "<a href='index.php?option=com_virtuemart&page=shop.cart' target='_blank'><img src=\"".$mm_action_url.'components/com_virtuemart/shop_image/ps_image/Cart_1_Green-Full.png'."\" alt=\"Shopping Cart\" width=\"32\" border=\"0\" valign=\"center\" align=\"center\" /></a>";
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $html .= '</td></div></tr>';
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $html; } 
      &nbsp; &nbsp; &nbsp; &nbsp; else {
      &nbsp; &nbsp; &nbsp; &nbsp; if ($params->get( 'sc_show_logo')) {
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "<div align=\"right\">";
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "<a href='index.php?option=com_virtuemart&page=shop.cart' target='_blank'><img src=\"".$mm_action_url.'components/com_virtuemart/shop_image/ps_image/Cart_1_Green.png'."\" alt=\"Shopping Cart\" width=\"32\" border=\"0\" valign=\"center\" align=\"center\" /></a>";
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "</div>";
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
      &nbsp; &nbsp; &nbsp; &nbsp; }
      &nbsp; &nbsp; &nbsp; &nbsp; ?>
      &nbsp; &nbsp; &nbsp; &nbsp; 
      &nbsp; &nbsp; </table>

      Now the cart_1_green.png and cart_1_green-Full.png are the image, the are one image, but change based on whether there is anything in the cart or not. So that is what needs div class= cartmsg2 styling. Somewhere in there is a variable that is calling for the text message. However,, come to think of it, if I could just get the div class style to work on the image, then I could position the module, by way of the whole module because of the suffix, so that the text is in the right spot, and then position the image. So I really only need one div class=, I just need to figure out where the heck to stick it to make it work!LOL

      So any ideas or suggestions?:)

      Thanks,
      David Henderson
  • Re: Using div classes in a module php file?

    Posted 18 years 4 weeks ago
    • OK I figured it out, I had to place the div class tags just outside the php tags for them to work. So I put the div class just before an opening php tag, and the </div> just after it closed the php:) All is working now!
  • Re: Using div classes in a module php file?

    Posted 18 years 4 weeks ago
    • Glad we could help. ;D
  • Re: Using div classes in a module php file?

    Posted 18 years 4 weeks ago
    • John Sanchez wrote:
      Glad we could help. ;D

      Funny enough, I have found that just posting my questions here sometimes helps me to solve the problem. That's why if you look at my posts, a lot of times you will see me answering my own questions a few hours later. It's a mixture of having to think the problem out enough to be able to explain it here on the forum to others, therefor understanding it a bit more myself. Combined with a little bit of pressure relief by posting it here and knowing that many others are looking at it and trying to help me solve it, so I am no longer alone. I can go back to it, a little more relaxed, and with the thought that if I can't figure it out, I may be able to come back here and find an answer or at least a suggestion to lead me in a better path. So that takes a bit of the weight off of my shoulders and sometimes helps me to solve the problem:)

      Thanks,
      David Henderson
  • Re: Using div classes in a module php file?

    Posted 18 years 4 weeks ago
    • The power of Rocket Theme, its a strange phenomina!
      This image is hidden for guests.
      Please log in or register to see it.
    • James Spencer / Developer & Support / Hull, UK
    • Yves's Avatar
    • Yves
    • Preeminent Rocketeer
    • Posts: 9214
    • Thanks: 5

    Re: Using div classes in a module php file?

    Posted 18 years 4 weeks ago
    • Well stated, David.
      The greatest challenge to any thinker is stating the problem in a way that will allow a solution.

      Bertrand Russell (1872-1970)
    • Yves

Time to create page: 0.063 seconds