- Posts: 398
COMMUNITY FORUM
K2 Templating and css
- troponin
- Topic Author
- Offline
- Platinum Member
Less
More
14 years 10 months ago #76889
by troponin
K2 Templating and css was created by troponin
In the K2 plugin the code looks if in the Joomla Template css folder is a k2.css if not use the k2.css of com_k2
Line 69 of K2.php System Plugin :
if(JFile::exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'css'.DS.'k2.css'))
$document->addStyleSheet(JURI::root().'templates/'.$mainframe->getTemplate().'/css/k2.css');
else
$document->addStyleSheet(JURI::root().'components/com_k2/css/k2.css');
I need one css for every k2 template i have.
Olivier Nolbert posted a solution in this thread
But with this solution bothe css - k2 Standard and the modified is loaded.
Is it possible to merge both codes to get the right code ?
If no template is set = Use K2.css
If %template% is set = use %template%.css
Line 69 of K2.php System Plugin :
if(JFile::exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'css'.DS.'k2.css'))
$document->addStyleSheet(JURI::root().'templates/'.$mainframe->getTemplate().'/css/k2.css');
else
$document->addStyleSheet(JURI::root().'components/com_k2/css/k2.css');
I need one css for every k2 template i have.
Olivier Nolbert posted a solution in this thread
But with this solution bothe css - k2 Standard and the modified is loaded.
Is it possible to merge both codes to get the right code ?
If no template is set = Use K2.css
If %template% is set = use %template%.css
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
Less
More
- Posts: 955
14 years 10 months ago #76890
by Simon Wells
Replied by Simon Wells on topic K2 Templating and css
I think this is a very important point.
If we are able to provide addition K2 micro themes with a view to being to style parts of a site as blog/magazine/community etc, then we need to have control of the CSS.
It makes no sense to that the micro theme has to share the the global css.
I second the the vote to add this as a feature.
If we are able to provide addition K2 micro themes with a view to being to style parts of a site as blog/magazine/community etc, then we need to have control of the CSS.
It makes no sense to that the micro theme has to share the the global css.
I second the the vote to add this as a feature.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Away
- Admin
Less
More
- Posts: 6218
14 years 10 months ago #76891
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 Templating and css
First of all, even if we have a dozen sub-templates used in K2, we can still have 1 global K2 css file (or our joomla template CSS file). There is no reason to load many CSS files to cover the styling of multiple K2 sub-templates.
That is why I'm using strict CSS "specificity", so you can make a new menu item fetching K2 with a sub-template and you can give it a "page class suffix" to override or style differently that particular content. This is very clear and it's not subject to any changes.
Regarding CSS overrides in v2.2 (coming soon)...
What we've done in 2.2 is provide the ability to template designers to directly override K2's CSS without telling the user to go into K2's parameters and switching the K2 CSS off. The only thing template designers have to do is include 3 additional CSS files in their template's /css folder: k2.css, k2_ie6.css and k2_ie7.css
If they include these 3 files, then K2 will pick them up and ignore its default CSS files. If they don't exist, it will just include the default CSS files.
That is why I'm using strict CSS "specificity", so you can make a new menu item fetching K2 with a sub-template and you can give it a "page class suffix" to override or style differently that particular content. This is very clear and it's not subject to any changes.
Regarding CSS overrides in v2.2 (coming soon)...
What we've done in 2.2 is provide the ability to template designers to directly override K2's CSS without telling the user to go into K2's parameters and switching the K2 CSS off. The only thing template designers have to do is include 3 additional CSS files in their template's /css folder: k2.css, k2_ie6.css and k2_ie7.css
If they include these 3 files, then K2 will pick them up and ignore its default CSS files. If they don't exist, it will just include the default CSS files.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- troponin
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 398
14 years 10 months ago #76892
by troponin
Replied by troponin on topic K2 Templating and css
You are right there is no reason to load many css files, bur I must repeat.
If you dont have a css for every template you are limited in design your subtemplate.
just a small example:
If I want to have a big Heading in Template A and a small in Template B I have to set a new class in one of them.
If K2 would ask which template is loaded and use the specified CSS the designer always can copy the template.php's and just have to edit the specified.css
If you dont have a css for every template you are limited in design your subtemplate.
just a small example:
If I want to have a big Heading in Template A and a small in Template B I have to set a new class in one of them.
If K2 would ask which template is loaded and use the specified CSS the designer always can copy the template.php's and just have to edit the specified.css
Please Log in or Create an account to join the conversation.
- Oceanwatcher
- Offline
- Elite Member
Less
More
- Posts: 175
14 years 10 months ago #76893
by Oceanwatcher
Replied by Oceanwatcher on topic K2 Templating and css
There is a lot of "but's" in my mind regarding this as I am struggling a little with this already.
First of all -
We are already able to turn off the K2.css through a setting. But this rarely produce any desired effects as the template you are using almost certainly do not have styling for every part of K2. So you are left with a broken site that needs to be styled all over again.
In an ideal world, all template designers would jump for joy and make the suggested overrides. BUT - as the new overrides prohibits the normal K2.css from working, will we not get into the same trouble if they forget to add something or just leaves it out on purpose?
Here is what I would like to see:
A new configuration setting that turns off the part of the K2.css that is most likely covered by the main template. This would include all standard settings like H1, H2 and other font parameters etc. Let the normal template.css take care of this with just a checkmark in a setting. It already exist there, so why should I need to do anything else to get it to work?
I am not sure how this could be done, maybe by using two css files for K2 - K2basic.css and K2ext.css and then be able to not load K2basic.css.
My struggle right now is to use as much as possible of the styling from the main template to get K2 totally integrated while keeping the styling of the unique K2 features from the K2.css file. And doing it in such a way that these changes are intact when I upgrade K2 or the site template.
Not an easy task...
And I totally agree with Simon in that this is an important point. I think every effort should be made to make K2 as easy as possible to integrate.
JoomlaWorks said:First of all, even if we have a dozen sub-templates used in K2, we can still have 1 global K2 css file (or our joomla template CSS file). There is no reason to load many CSS files to cover the styling of multiple K2 sub-templates.
That is why I'm using strict CSS "specificity", so you can make a new menu item fetching K2 with a sub-template and you can give it a "page class suffix" to override or style differently that particular content. This is very clear and it's not subject to any changes.
Regarding CSS overrides in v2.2 (coming soon)...
What we've done in 2.2 is provide the ability to template designers to directly override K2's CSS without telling the user to go into K2's parameters and switching the K2 CSS off. The only thing template designers have to do is include 3 additional CSS files in their template's /css folder: k2.css, k2_ie6.css and k2_ie7.css
If they include these 3 files, then K2 will pick them up and ignore its default CSS files. If they don't exist, it will just include the default CSS files.
First of all -
We are already able to turn off the K2.css through a setting. But this rarely produce any desired effects as the template you are using almost certainly do not have styling for every part of K2. So you are left with a broken site that needs to be styled all over again.
In an ideal world, all template designers would jump for joy and make the suggested overrides. BUT - as the new overrides prohibits the normal K2.css from working, will we not get into the same trouble if they forget to add something or just leaves it out on purpose?
Here is what I would like to see:
A new configuration setting that turns off the part of the K2.css that is most likely covered by the main template. This would include all standard settings like H1, H2 and other font parameters etc. Let the normal template.css take care of this with just a checkmark in a setting. It already exist there, so why should I need to do anything else to get it to work?
I am not sure how this could be done, maybe by using two css files for K2 - K2basic.css and K2ext.css and then be able to not load K2basic.css.
My struggle right now is to use as much as possible of the styling from the main template to get K2 totally integrated while keeping the styling of the unique K2 features from the K2.css file. And doing it in such a way that these changes are intact when I upgrade K2 or the site template.
Not an easy task...
And I totally agree with Simon in that this is an important point. I think every effort should be made to make K2 as easy as possible to integrate.
JoomlaWorks said:First of all, even if we have a dozen sub-templates used in K2, we can still have 1 global K2 css file (or our joomla template CSS file). There is no reason to load many CSS files to cover the styling of multiple K2 sub-templates.
That is why I'm using strict CSS "specificity", so you can make a new menu item fetching K2 with a sub-template and you can give it a "page class suffix" to override or style differently that particular content. This is very clear and it's not subject to any changes.
Regarding CSS overrides in v2.2 (coming soon)...
What we've done in 2.2 is provide the ability to template designers to directly override K2's CSS without telling the user to go into K2's parameters and switching the K2 CSS off. The only thing template designers have to do is include 3 additional CSS files in their template's /css folder: k2.css, k2_ie6.css and k2_ie7.css
If they include these 3 files, then K2 will pick them up and ignore its default CSS files. If they don't exist, it will just include the default CSS files.
Please Log in or Create an account to join the conversation.
- Jiliko.net
- Offline
- Platinum Member
Less
More
- Posts: 567
14 years 10 months ago #76894
by Jiliko.net
Replied by Jiliko.net on topic K2 Templating and css
Hi,
I've made a k2 plugin that detects the use of a specific k2 template for a category and loads it. It's possible to disable the k2 generic css in the plugin settings.
No need to modify the k2 system plugin anymore.
Hope it will help Troponin and will not hurt Fotis :-)
Olivier Nolbert
www.jiliko.net
I've made a k2 plugin that detects the use of a specific k2 template for a category and loads it. It's possible to disable the k2 generic css in the plugin settings.
No need to modify the k2 system plugin anymore.
Hope it will help Troponin and will not hurt Fotis :-)
Olivier Nolbert
www.jiliko.net
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
Less
More
- Posts: 955
14 years 10 months ago #76895
by Simon Wells
Replied by Simon Wells on topic K2 Templating and css
Hi Olivier,
I will test this at K2Joom.com and post an item for it.
Olivier Nolbert said:Hi,
I've made a k2 plugin that detects the use of a specific k2 template for a category and loads it. It's possible to disable the k2 generic css in the plugin settings.
No need to modify the k2 system plugin anymore.
Hope it will help Troponin and will not hurt Fotis :-)
Olivier Nolbert
www.jiliko.net
I will test this at K2Joom.com and post an item for it.
Olivier Nolbert said:Hi,
I've made a k2 plugin that detects the use of a specific k2 template for a category and loads it. It's possible to disable the k2 generic css in the plugin settings.
No need to modify the k2 system plugin anymore.
Hope it will help Troponin and will not hurt Fotis :-)
Olivier Nolbert
www.jiliko.net
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
Less
More
- Posts: 955
14 years 10 months ago #76896
by Simon Wells
Replied by Simon Wells on topic K2 Templating and css
Hi Oliver, I have done a review of your plugin, great work.
I notice that although styling changes per item in the category that has a template set, the items listed with in the category do not change.
My review contains example items and categories.
Finally, I have also setup a download section and added the plugin to it.
@Fotis, I would like to offer the manage the storage K2 downloads at K2Joom if you wish.
Simon Wells said:Hi Olivier,
I will test this at K2Joom.com and post an item for it.
Olivier Nolbert said:Hi, I've made a k2 plugin that detects the use of a specific k2 template for a category and loads it. It's possible to disable the k2 generic css in the plugin settings.
No need to modify the k2 system plugin anymore.
Hope it will help Troponin and will not hurt Fotis :-)
Olivier Nolbert
www.jiliko.net
I notice that although styling changes per item in the category that has a template set, the items listed with in the category do not change.
My review contains example items and categories.
Finally, I have also setup a download section and added the plugin to it.
@Fotis, I would like to offer the manage the storage K2 downloads at K2Joom if you wish.
Simon Wells said:Hi Olivier,
I will test this at K2Joom.com and post an item for it.
Olivier Nolbert said:Hi, I've made a k2 plugin that detects the use of a specific k2 template for a category and loads it. It's possible to disable the k2 generic css in the plugin settings.
No need to modify the k2 system plugin anymore.
Hope it will help Troponin and will not hurt Fotis :-)
Olivier Nolbert
www.jiliko.net
Please Log in or Create an account to join the conversation.
- troponin
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 398
14 years 10 months ago #76897
by troponin
Replied by troponin on topic K2 Templating and css
Hi Olivier,
n1 work - this is exactly what I needed.
I wrote you an email - it is exactly what Simon says (Simon says,...;) ) Is it possible to load the custom css in the items in the category ?
n1 work - this is exactly what I needed.
I wrote you an email - it is exactly what Simon says (Simon says,...;) ) Is it possible to load the custom css in the items in the category ?
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
Less
More
- Posts: 955
14 years 10 months ago #76898
by Simon Wells
Replied by Simon Wells on topic K2 Templating and css
I agree, if your are selecting a template for a category, then lets get that category styled too the same and not just the item.
There are still elements that use the default Joomla template which need to be over ridden.
Troponin said:Hi Olivier,
n1 work - this is exactly what I needed.
I wrote you an email - it is exactly what Simon says (Simon says,...;) ) Is it possible to load the custom css in the items in the category ?
There are still elements that use the default Joomla template which need to be over ridden.
Troponin said:Hi Olivier,
n1 work - this is exactly what I needed.
I wrote you an email - it is exactly what Simon says (Simon says,...;) ) Is it possible to load the custom css in the items in the category ?
Please Log in or Create an account to join the conversation.