- Posts: 137
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Add item or cat ID, NAME or even TYPE to body or html class suffix
Add item or cat ID, NAME or even TYPE to body or html class suffix
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
4 years 7 months ago - 4 years 7 months ago #175392
by Gorast
Add item or cat ID, NAME or even TYPE to body or html class suffix was created by Gorast
Hello,
I hope this post find you well and healthy :D
I need some heavy styling to my pages but I need to separate K2 items from category listing.
How can I add class or ID suffix to the body or html tags of the page?
Ideally I wold have class="item-ID cat-ID k2item (or k2cat, if its a listing)".
I managed to add this to the <article> adding "k2Item-<?php echo $this->item->id; ?>" but not working on the page.
How can I achieve this?
Thanks,
Gorast
I hope this post find you well and healthy :D
I need some heavy styling to my pages but I need to separate K2 items from category listing.
How can I add class or ID suffix to the body or html tags of the page?
Ideally I wold have class="item-ID cat-ID k2item (or k2cat, if its a listing)".
I managed to add this to the <article> adding "k2Item-<?php echo $this->item->id; ?>" but not working on the page.
How can I achieve this?
Thanks,
Gorast
Last edit: 4 years 7 months ago by Gorast.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 7 months ago #175397
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
Can you add the class to the <body> tag of your template? Or are you using a template framework that constructs the output and makes it hard to edit that tag?
If you can edit it, then use this code: github.com/joomlaworks/Takai/blob/master/includes/helper.php#L162 (the are also references at the top of that file)
If you can edit it, then use this code: github.com/joomlaworks/Takai/blob/master/includes/helper.php#L162 (the are also references at the top of that file)
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
4 years 7 months ago - 4 years 7 months ago #175403
by Gorast
Replied by Gorast on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
Hello,
it uses Gavick template. The line that gets the body code is in default.php:
$tpl_page_suffix = $page_suffix_output != '' ? ' class="'.$page_suffix_output.'" ' : '';
<body<?php echo $tpl_page_suffix; ?><?php if($this->browser->get("tablet") == true).....>
it uses Gavick template. The line that gets the body code is in default.php:
$tpl_page_suffix = $page_suffix_output != '' ? ' class="'.$page_suffix_output.'" ' : '';
<body<?php echo $tpl_page_suffix; ?><?php if($this->browser->get("tablet") == true).....>
Last edit: 4 years 7 months ago by Gorast.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 7 months ago #175420
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
Grab the code I mentioned and adapt it accordingly then.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
4 years 7 months ago #175422
by Gorast
Replied by Gorast on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
hey Fotis,
I got this code from the theme developer and work properly. It suits my needs:
<html class="<?php if(isJoomla4()) echo 'j4'; ?> <?php echo $option; ?> layout-<?php echo $layout; ?> view-<?php echo $view ?>" lang="<?php echo $this->APITPL->language; ?>" <?php echo $tpl_page_suffix; ?> >
The one thing they couldn't manage is to get the actual item ID.
Thanks,
Gorast
I got this code from the theme developer and work properly. It suits my needs:
<html class="<?php if(isJoomla4()) echo 'j4'; ?> <?php echo $option; ?> layout-<?php echo $layout; ?> view-<?php echo $view ?>" lang="<?php echo $this->APITPL->language; ?>" <?php echo $tpl_page_suffix; ?> >
The one thing they couldn't manage is to get the actual item ID.
Thanks,
Gorast
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 7 months ago #175432
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
<?php echo JRequest::getInt('id'); ?>
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gorast
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 137
4 years 7 months ago #175434
by Gorast
Replied by Gorast on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
YEAH! :D
Tnx!
Tnx!
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 7 months ago #175435
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Add item or cat ID, NAME or even TYPE to body or html class suffix
You're welcome.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Add item or cat ID, NAME or even TYPE to body or html class suffix