Different Styling on Home Page and Inner Pages

More
11 years 2 months ago #34019 by juanpiggee
I need to style the class .content_sparky.span12 differently on the home page of a website than on the inner pages. I've tried using .sparky_home.content_sparky.span12 but that doesn't seem to work. The documentation says I should be able to use that to style the homepage differently. Maybe I'm doing it wrong. Can you please help? I would submit a link but I'm working on a local install. The issue is that I need some padding on inner pages but not on the homepage. There is only an image rotator on the home page and adding the padding to this element adds the padding on the home page making a blank white space of just padding under the image rotator. It looks like a big empty white box. See the screenshot attached. Any help would be greatly appreciated.

Please Log in to join the conversation.

More
11 years 2 months ago #34024 by ivan.milic
See this - how to check if on home page

docs.joomla.org/How_to_determine_if_the_...ewing_the_front_page

based on that set some class on <body> element in index.php of template.

Please Log in to join the conversation.

More
11 years 2 months ago #34031 by juanpiggee
Thanks for your response Ivan. I'm not sure I understand how to do that. Are you saying to add a php statement to the index.php of the template something like this:

<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
.content_sparky.span12 {padding:0px;}
}
?>

If so, where would that need to be placed?

Please Log in to join the conversation.

More
11 years 2 months ago #34032 by juanpiggee
I examined the index.php of the template and it seems that what you're suggesting has already been done by the method I originally asked about. The code appears to check if the the page is the default and assign the body the class sparky_home. Am I misunderstanding? Here is the code I'm referring to:

<?php $menu = JSite::getMenu(); ?>
<body<?php if ($menu->getActive() == $menu->getDefault()) { echo ' class="sparky_home"'; }else{ echo ' class="sparky_inner"'; } ?>>

Please Log in to join the conversation.

More
11 years 2 months ago #34034 by ivan.milic
you can use that then:

use:


.sparky_home .content_sparky.span12{
...
}

for home page style, use:

.sparky_inner .content_sparky.span12{
...
}

for inner pages style
The following user(s) said Thank You: juanpiggee

Please Log in to join the conversation.

More
11 years 2 months ago #34058 by juanpiggee
Ah, the space! I was missing the space. Thanks for your help and I apologize for missing such a simple thing on my own.

Please Log in to join the conversation.

Time to create page: 0.165 seconds
Powered by Kunena Forum