- Posts: 14
COMMUNITY FORUM
i want to add style condition to the css style
- Mhad Morph
- Topic Author
- Offline
- New Member
Less
More
8 years 5 months ago #153034
by Mhad Morph
i want to add style condition to the css style was created by Mhad Morph
hello
i want to add style condition to the css style
for example
i have k2 content , if the language is en i want specific style
of the language ar i want specific language
i want to add style condition to the css style
for example
i have k2 content , if the language is en i want specific style
of the language ar i want specific language
Please Log in or Create an account to join the conversation.
- Javi Mata
- Offline
- Senior Member
8 years 5 months ago #153042
by Javi Mata
Twitter: @Javi_Mata
Web: www.javimata.com
Replied by Javi Mata on topic i want to add style condition to the css style
if know modified your templates can add some like this:
$lang = JFactory::getLanguage();
$classLang = "item-" . $lang->getTag();
and add this variable in the class of the div
$lang = JFactory::getLanguage();
$classLang = "item-" . $lang->getTag();
and add this variable in the class of the div
Twitter: @Javi_Mata
Web: www.javimata.com
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 5 months ago #153063
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic i want to add style condition to the css style
Javi has proposed a smart solution,
remember to use overrides instead of editing core files as well.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
remember to use overrides instead of editing core files as well.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Mhad Morph
- Topic Author
- Offline
- New Member
Less
More
- Posts: 14
8 years 5 months ago #153142
by Mhad Morph
Replied by Mhad Morph on topic i want to add style condition to the css style
thank you very much for replay .
but can you be more specific , were to but this code and how to select a lang.
but can you be more specific , were to but this code and how to select a lang.
Please Log in or Create an account to join the conversation.
- Mhad Morph
- Topic Author
- Offline
- New Member
Less
More
- Posts: 14
8 years 5 months ago #153145
by Mhad Morph
Replied by Mhad Morph on topic i want to add style condition to the css style
thank you very much for replay .
but can you be more specific , were to but this code and how to select a lang.
but can you be more specific , were to but this code and how to select a lang.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 5 months ago #153157
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic i want to add style condition to the css style
This is template specific so I cannot share precise code.
This code needs to be applied on the module's override.
(/templates/YOUR_TEMPLATE/html/mod_k2_content/YOUR_K2_CONTENT_TEMPLATE)
This code needs to be applied on the module's override.
(/templates/YOUR_TEMPLATE/html/mod_k2_content/YOUR_K2_CONTENT_TEMPLATE)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Mhad Morph
- Topic Author
- Offline
- New Member
Less
More
- Posts: 14
8 years 5 months ago #153181
by Mhad Morph
Replied by Mhad Morph on topic i want to add style condition to the css style
thank you for reply i ask how to choose a class or lang from this code
i try it and it and not work even with standard joomla
i try it and it and not work even with standard joomla
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 5 months ago #153195
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic i want to add style condition to the css style
Check my reply on the other thread if the issue is only related to text direction.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Javi Mata
- Offline
- Senior Member
8 years 5 months ago - 8 years 5 months ago #153200
by Javi Mata
Twitter: @Javi_Mata
Web: www.javimata.com
Replied by Javi Mata on topic i want to add style condition to the css style
the best is, create a override template in the folder html of your template, like tell you Krikor
in this template, in the file category.php can do it this:
<?php
$lang = JFactory::getLanguage();
$classLang = "lang-" . $lang->getTag();
?>
<div id="k2Container" class="<?php echo $classLang; ?> itemListView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
with this you add a class lang-XXX where XXX is the language tag, with this you can add in your css the class for each language
sorry if can explain more, i don't speak english :-D
in this template, in the file category.php can do it this:
<?php
$lang = JFactory::getLanguage();
$classLang = "lang-" . $lang->getTag();
?>
<div id="k2Container" class="<?php echo $classLang; ?> itemListView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
with this you add a class lang-XXX where XXX is the language tag, with this you can add in your css the class for each language
sorry if can explain more, i don't speak english :-D
Twitter: @Javi_Mata
Web: www.javimata.com
Last edit: 8 years 5 months ago by Javi Mata.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6213
8 years 5 months ago - 8 years 5 months ago #153214
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic i want to add style condition to the css style
Or you could do everything purely in CSS.
Joomla (and I hope your template) is already outputting a language identifier on the <html> tag. If it doesn't, see how the "system" template under /templates/system/index.php does it and copy it to your template.
Then you can use the :lang() pseudo selector (as old as the CSS 2.1 spec): css-tricks.com/almanac/selectors/l/lang/
Or you can use attribute selectors like this (info here: css-tricks.com/attribute-selectors/) like this:
:)
Joomla (and I hope your template) is already outputting a language identifier on the <html> tag. If it doesn't, see how the "system" template under /templates/system/index.php does it and copy it to your template.
Then you can use the :lang() pseudo selector (as old as the CSS 2.1 spec): css-tricks.com/almanac/selectors/l/lang/
Or you can use attribute selectors like this (info here: css-tricks.com/attribute-selectors/) like this:
html[lang="en-gb"] #someElement p {color:red;}
html[lang="fr-fr"] #someElement p {color:blue;}
:)
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 8 years 5 months ago by JoomlaWorks.
Please Log in or Create an account to join the conversation.