Keyword

K2 Subtemplate customization

  • olsen
  • olsen's Avatar Topic Author
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
15 years 2 months ago #71866 by olsen
K2 Subtemplate customization was created by olsen
Hi,
I am playing now with the K2 subtemplate customization feature. It looks really great feature and opens an universe of custom layouts.

Until now, i changed the k2 style.css file and my subtemplate default.php to fit my needs.
It works fine, but what i would like to, is to separate my custom css code of the main style.css file, so its easy to make unlimited layouts, without need to change name id or class, or appendix a suffix to it at main style.css, for each subtemplate created.

Also it would be easy to export these subtemplates at easy way.

My question now, is how or where can i call this new css file?? I think it should be done at admin.k2.php file but i´m not sure.

Any help is appreciated
Thanks
rgds

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

Please Log in or Create an account to join the conversation.

More
15 years 2 months ago #71867 by Valdis
Replied by Valdis on topic K2 Subtemplate customization
You can attach additional stylesheets from k2 template code:
k2community.joomlaworks.gr/xn/detail/3536014:Comment:13645

Please Log in or Create an account to join the conversation.

  • olsen
  • olsen's Avatar Topic Author
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
15 years 2 months ago #71868 by olsen
Replied by olsen on topic K2 Subtemplate customization
Valdis said:For now it's possible to add css for each template using something like this inside template php files (like item.php and such): $doc =& JFactory::getDocument();
$doc->addStyleSheet( 'www.example.com/css/mystylesheet.css' );

You can attach additional stylesheets from k2 template code:
k2community.joomlaworks.gr/xn/detail/3536014:Comment:13645


Thanks for this info.It works good.
Just one question: at the addStylesheet you write a absolute path to the css file. What i would like to do is get relative path to it.

I tried these instance JURI, JPATH but i cant not figure it work.
Any help will be aprecietted
Thanks

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

Please Log in or Create an account to join the conversation.

  • olsen
  • olsen's Avatar Topic Author
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
15 years 2 months ago #71869 by olsen
Replied by olsen on topic K2 Subtemplate customization
OK! i did it.
This is what it must be added:
$doc =& JFactory::getDocument();
$doc->addStyleSheet(JURI::base().'modules/mod_k2_content/tmpl/foldername/filename.css' );

rgds

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #71870 by David Patrick
Replied by David Patrick on topic K2 Subtemplate customization
I am not very experienced with custom templating these files, and was wondering if someone might put a tutorial together. I think it would benefit K2 tremendously. My problem right now is that I want to use K2 for its custom fields, but on the category list layout, it doesn't necessarily display as a list. It is most like an article layout.

I would like for the Category List to look more like the Joomla default Category list layout with a table (myfirstbrew.com/hops-list.html) but I want to have the tables populated with custom fields and what not. Can anyone do this? I'd be willing to shoot you some funds for it.

Please Log in or Create an account to join the conversation.

  • olsen
  • olsen's Avatar Topic Author
  • Offline
  • Elite Member
  • Joomla and K2 Freelancer
More
15 years 1 month ago #71871 by olsen
Replied by olsen on topic K2 Subtemplate customization
Sorry man, but i cant understand exactly what you want.

David Patrick said:I am not very experienced with custom templating these files, and was wondering if someone might put a tutorial together. I think it would benefit K2 tremendously. My problem right now is that I want to use K2 for its custom fields, but on the category list layout, it doesn't necessarily display as a list. It is most like an article layout.
I would like for the Category List to look more like the Joomla default Category list layout with a table (myfirstbrew.com/hops-list.html) but I want to have the tables populated with custom fields and what not. Can anyone do this? I'd be willing to shoot you some funds for it.

Didn't solve your issues?? Why dont you consider hire me? Email me or contact me www.xevedigital.com for details

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #71872 by Jiliko.net
Replied by Jiliko.net on topic K2 Subtemplate customization
Hi everyone,

here's what i've done to load a specific template css file :

In the file 'plugins/system/k2.php' / function 'onAfterDispatch()' / Line 61,

I've added the lines :

$params = &JComponentHelper::getParams('com_k2');

if($params->get('theme'))
{
$doc =& JFactory::getDocument();
$doc->addStyleSheet(JURI::base().'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme').DS.$params->get('theme').'_style.css');
}

This enables to load the css file which name is _style.css (where is your k2 template name.

Hope It will help...

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #71873 by Jochen Kästle
Replied by Jochen Kästle on topic K2 Subtemplate customization
hi! I tried this within v2.2 - but it seems as it didn't work :( any ideas? Thx!!!

Olivier Nolbert said:Hi everyone,
here's what i've done to load a specific template css file :

In the file 'plugins/system/k2.php' / function 'onAfterDispatch()' / Line 61,

I've added the lines :

$params = &JComponentHelper::getParams('com_k2');

if($params->get('theme'))
{
$doc =& JFactory::getDocument();
$doc->addStyleSheet(JURI::base().'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme').DS.$params->get('theme').'_style.css');
}

This enables to load the css file which name is _style.css (where is your k2 template name.

Hope It will help...

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #71874 by troponin
Replied by troponin on topic K2 Subtemplate customization
yep - Read this

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #71875 by Jochen Kästle
Replied by Jochen Kästle on topic K2 Subtemplate customization
oh oh looks like I was a little bit blind..thanks for the hint :)

Troponin said:yep - Read this

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum