Post by xemox » Wed Jun 18, 2014 4:57 pm

I help my friend to modified his web. I'd like to give his web some changes in css.

I tried to load additional css with this method '$this->document->addStyle'

At default theme it work perfect but in his template it seems wont load properly.

What may cause this things happen? ???

Newbie

Posts

Joined
Mon Sep 03, 2012 2:48 pm

Post by IP_CAM » Wed Jun 18, 2014 8:27 pm

why not just using the (default and custom template) stylesheet.css an add style-content there?
They have to be modified both (the same way) in order to present changes in the default template as well as in the Custom Template.

Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by xemox » Thu Jun 19, 2014 12:24 pm

Hi Ernie,
Thanks for your suggestion. However I plan not to modify his core files at this moment.
Beside, the css I need to plant is only for specific page.

xemox

Newbie

Posts

Joined
Mon Sep 03, 2012 2:48 pm

Post by agrimabo » Thu Jun 19, 2014 1:58 pm

for global css, in:

catalog/controller/common/header.php

you could add:

Code: Select all

//load custom css
$this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/custom.css');
or if you wanna be more specific, you could apply styles to information pages by add the following to:

catalog/controller/information/information.php

Code: Select all

if ( isset($this->request->get['information_id']) && $this->request->get['information_id'] == '10') {
$this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template'). '/stylesheet/pagename.css');
}
in this case, the css file would be loaded if the information id = 10.

Newbie

Posts

Joined
Fri Nov 01, 2013 8:04 am

Post by qahar » Thu Jun 19, 2014 5:34 pm

xemox wrote:I tried to load additional css with this method '$this->document->addStyle'

At default theme it work perfect but in his template it seems wont load properly.
Open catalog\view\theme\your_theme\template\common\header.tpl
Make sure code below is available.

Code: Select all

<?php foreach ($styles as $style) { ?>
<link rel="<?php echo $style['rel']; ?>" type="text/css" href="<?php echo $style['href']; ?>" media="<?php echo $style['media']; ?>" />
<?php } ?>
For specific page, as agrimabo suggest

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia
Who is online

Users browsing this forum: Bing [Bot] and 396 guests