Advertisement
Page class suffix to change background image in the body
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Tue Oct 27, 2009 11:13 am
Page class suffix to change background image in the body
Hello and thank you for reading this...
I have been trying to do this for a few hours now and I cant figure it out.
I want to set a background image for my index page I am trying to do this by using the page class Menus > Main Menu > Home > Page Display Options in the box labeled Page Class
I enter the suffix with a leading space index
my css code looks like this
.background {position: absolute;width: 100%; background: #E8E1CE url(../images/bg.jpg) 0 0 repeat-x;}
.background.index {position: absolute;width: 100%; background: #E8E1CE url(../images/bgHomePage.jpg) 0 0 repeat-x;}
my index.php file looks like this
<body class="background index">
I have tried everything I can think of and no avail. I have read articles about placing custom php code in the head and adding an include referencing the default class but it throws errors.
I need some help and an explanation please... before the rest of my hair turns grey!
Thank you.
I have been trying to do this for a few hours now and I cant figure it out.
I want to set a background image for my index page I am trying to do this by using the page class Menus > Main Menu > Home > Page Display Options in the box labeled Page Class
I enter the suffix with a leading space index
my css code looks like this
.background {position: absolute;width: 100%; background: #E8E1CE url(../images/bg.jpg) 0 0 repeat-x;}
.background.index {position: absolute;width: 100%; background: #E8E1CE url(../images/bgHomePage.jpg) 0 0 repeat-x;}
my index.php file looks like this
<body class="background index">
I have tried everything I can think of and no avail. I have read articles about placing custom php code in the head and adding an include referencing the default class but it throws errors.
I need some help and an explanation please... before the rest of my hair turns grey!
Thank you.
Advertisement
-
- Joomla! Apprentice
- Posts: 8
- Joined: Wed Jun 09, 2010 2:33 am
Re: Page class suffix to change background image in the body
Hi KJPhilips - I have EXACTLY the same problem. Did you get this resolved? Would be great if you could guide me.
thanks in advance.
thanks in advance.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Tue Oct 27, 2009 11:13 am
Re: Page class suffix to change background image in the body
Unfortunately I have not as of yet been able to figure this one out, I hope that someone here can direct me. I have read all of the documents in the wiki and although I don't consider myself an expert in css I am at least a novice! Seeing as I do this as a hobby in my spare time I am thinking I should switch to fishing!
-
- Joomla! Apprentice
- Posts: 8
- Joined: Wed Jun 09, 2010 2:33 am
Re: Page class suffix to change background image in the body
HA HA HA ! The BIG difference between Fishing and Software is that NOTHING is impossible in software. I'm sure a lot of Joomla Gurus will second me on this.
I'm putting together a detailed query for the folks here. I'm sure someone can help us out.
I'm putting together a detailed query for the folks here. I'm sure someone can help us out.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Tue Oct 27, 2009 11:13 am
Re: Page class suffix to change background image in the body
Yea my skills with the various languages produce results where as my skills with a fishing rod produce nothing! Thankfully I don't have to fish for my meals or I would be a very very thin man! I am still looking for the answer I am on hour 6, I will post here if I figure it out. If you find the solutions could you please PM me or something. Thanks for the comments it is nice to know I am not alone!
-
- Joomla! Apprentice
- Posts: 8
- Joined: Wed Jun 09, 2010 2:33 am
Re: Page class suffix to change background image in the body
No Problemo Amigo ! I've just put in a new post. Check it out - maybe my issue might not be exactly like yours, but all solutions will help.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Tue Oct 27, 2009 11:13 am
Re: Page class suffix to change background image in the body
OK I found the answer... and it looks as if this will work
and I replaced the body tag with this
in the menu items properties I used the suffix for the alternate style I wanted to use. I found that if i used the space before the suffix it didn't work so I put in the page class with NO space
The post I saw with this code said that this was the way to do it for Joomla 1.6
I would like to thank Mr. designsubway for his solution...
now I would like to know if there are any security issues with this regarding what I read in the Using the Page Class Suffix in Template Code tutorial about always using htmlspecialchars
Code: Select all
<?php
$app = JFactory::getApplication('site');
$pageclass = & $app->getParams('com_content');
?>
Code: Select all
<body class="<?php echo $pageclass ->get('pageclass_sfx'); ?>">
The post I saw with this code said that this was the way to do it for Joomla 1.6
I would like to thank Mr. designsubway for his solution...
now I would like to know if there are any security issues with this regarding what I read in the Using the Page Class Suffix in Template Code tutorial about always using htmlspecialchars
-
- Joomla! Apprentice
- Posts: 8
- Joined: Wed Jun 09, 2010 2:33 am
Re: Page class suffix to change background image in the body
Hey KJ - I think that's exactly what is the solution. However I've decided to migrate away from Joomla for my project. Primarily due to IE and its incompatibility with some of extensions.
-
- Joomla! Fledgling
- Posts: 2
- Joined: Wed May 11, 2011 1:23 am
Re: Page class suffix to change background image in the body
This works. Thanks.
-
- Joomla! Apprentice
- Posts: 16
- Joined: Sun Mar 06, 2011 2:03 am
- Location: US
Re: Page class suffix to change background image in the body
thanks!
kjphilips wrote:and I replaced the body tag with thisCode: Select all
<?php $app = JFactory::getApplication('site'); $pageclass = & $app->getParams('com_content'); ?>
Code: Select all
<body class="<?php echo $pageclass ->get('pageclass_sfx'); ?>">
Advertisement