Post by korisnik » Tue Feb 26, 2019 8:24 am

How to add custom css with ocmod?
I tried to add custom css in stylesheet.css with ocmod, but not work.

New member

Posts

Joined
Sun Aug 07, 2016 1:21 am

Post by korisnik » Tue Feb 26, 2019 9:56 am

I succeed via header.twig and custom.css

New member

Posts

Joined
Sun Aug 07, 2016 1:21 am

Post by Johnathan » Tue Feb 26, 2019 9:51 pm

Just for others that find this info, ocMod (and vQmod) can only affect .php files. It cannot affect .css and .js files, so you need to load the file separately and put that into the header.php file, or just add the CSS/javascript directly into a front-end template file.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by korisnik » Wed Feb 27, 2019 1:05 am

Please, more detailed explanation.
Which header.php, several exist?

New member

Posts

Joined
Sun Aug 07, 2016 1:21 am

Post by Johnathan » Wed Feb 27, 2019 2:21 am

There are only 2 header.php files in a normal installation. The front-end header.php file is located here:

/catalog/controller/common/header.php

The admin header.php is located here:

/admin/controller/common/header.php

If you want a front-end edit, you'd add it to the first file. If you want an admin-side edit, you'd add it to the second file.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by korisnik » Wed Feb 27, 2019 7:15 am

How to use this file to add custom css?

New member

Posts

Joined
Sun Aug 07, 2016 1:21 am

Post by Johnathan » Wed Feb 27, 2019 9:56 pm

Take a look at the "addScript" and "addLink" functions in the header.php file. It shows you how to add a custom CSS or JS file into the header controller file.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by korisnik » Mon Mar 18, 2019 8:16 pm

I found this:

Code: Select all

$this->document->addStyle('custom.css');
Is this right way?

New member

Posts

Joined
Sun Aug 07, 2016 1:21 am

Post by Johnathan » Mon Mar 18, 2019 10:25 pm

Yes, and put the path to the file within that function.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by korisnik » Tue Mar 19, 2019 7:40 pm

Is there some recommended folder for custom.css?

New member

Posts

Joined
Sun Aug 07, 2016 1:21 am

Post by Johnathan » Tue Mar 19, 2019 9:40 pm

Usually your theme's stylesheet directory is a good place:

/catalog/view/theme/YOURTHEME/stylesheet/

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 7 guests