X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Changing the padding of a block in the left column (https://forum.x-cart.com/showthread.php?t=73094)

xgarb 11-17-2015 09:21 AM

Changing the padding of a block in the left column
 
I have the news module in the left column but the text was squashed into a narrow column due to the high values for the css padding in sidebar_box.tpl.

To change this layout, I created a file NewsBoxWithModifiedSidebarbox.php and saved it with the other class files in my theme. The file looks like this...

Code:

<?php

namespace XLite\Module\Customer\CustomerTheme\View;

class NewsBoxWithModifiedSidebarbox extends \XLite\Module\XC\News\View\TopNewsSideBar  implements \XLite\Base\IDecorator
{
    /**
    * Return default template
    *
    * @return string
    */
    protected function getDefaultTemplate()
    {
        return 'modules/Customer/CustomerTheme/newsbox.tpl';
               
    }
       
}


This changes the normal sidebar_box.tpl template declared in XLite/View/SideBarBox to my own template at modules/Customer/CustomerTheme/newsbox.tpl.

My template...
Code:

<div class="{getBlockClasses()}">
  <div class="head-h2" IF="getHead()">{t(getHead())}</div>
  <div class="content" style="padding:0 10px 20px 0px; font-size:13px"><widget template="{getBody()}"></div>
</div>


I've used inline CSS to override the normal padding (temporary fix) and now my text has more horizontal space to flow.

This might not be the best way to do this but I thought I'd share in case someone is looking for the same thing.


All times are GMT -8. The time now is 11:50 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.