Reputation: 7
I am looking to hide a div on some pages that is appearing on all the pages. I have used some php and css to assign each page with a unique code but I cannot get the correct css to hide or remove the div from those pages.
.pageid111 .logo{
display: none;
}
is what I am attempting to use. Would appreciate any help
Upvotes: 0
Views: 798
Reputation: 3485
Instead of directly calling logo in all files, you can create a module and display it wherever needed. You have to change some codes in template files. I will give an example so you can do it for your own template.
If you see the default template protostar that comes with Joomla. it has a file named index.php. There $logo is defined at line number 67-78 as
// Logo file or site title param
if ($this->params->get('logoFile'))
{
$logo = '<img src="' . JUri::root() . $this->params->get('logoFile') . '" alt="' . $sitename . '" />';
}
elseif ($this->params->get('sitetitle'))
{
$logo = '<span class="site-title" title="' . $sitename . '">' . htmlspecialchars($this->params->get('sitetitle')) . '</span>';
}
else
{
$logo = '<span class="site-title" title="' . $sitename . '">' . $sitename . '</span>';
}
You can comment this out.
Next on the same file little below around line 140 you will find this code
<?php echo $logo; ?>
This code is calling the logo file. Just replace this code with
<jdoc:include type="modules" name="logo" style="xhtml" />
You have just added a new module position with name logo.
This will not reflect until you add this position in the templateDetails.xml
file
if you open that file you will find these lines
<positions>
<position>banner</position>
<position>debug</position>
<position>position-0</position>
<position>position-1</position>
.............
</positions>
Add logo position to that
<positions>
<position>banner</position>
<position>debug</position>
<position>logo</position>
<position>position-0</position>
<position>position-1</position>
.............
</positions>
So you now have a extra module position in place of hardcoded logo image. You can put any image module there or just create an html module.
Upvotes: 1
Reputation: 3241
A solution could be detect the home page using the joomla framework https://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page
Through the same getMenu() method you can generalize your code for the other menu items Joomla 3.1 - Get active menu item url
Upvotes: 0