page class suffix - could be more efficient

Locked
zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

page class suffix - could be more efficient

Post by zabdesign » Wed Nov 30, 2005 4:54 pm

Hello,

first of all I want to tell the developers that I love joomla!
Joomla is a beautifully peace of software!  :)

The page class suffix is a fine functionality,
but it could be more efficient, if there won't be new classnames for
several elements but only one id for each body tag!

Actually it takes me more time,
to define special formats like:

.bloghomepage {...}
.contenpanopenhomepage {...}
.contentheadinghompage {...}
...

.blogmysitexyz {...}
.contentheadingmysitexyz {...}
.contenpanopenmysitexyz {...}
...

Hey, why so complicated?
The names grow longer and in spite of comments it is not easy to recover the right
style definition in a complex css file.

The actual effectiveness is not what Cascading Style Sheets really means!
Why not use the full power of CSS?
The effect of this solution would be, that my css-files are clearer and the HTML-sourcecode would be slimmer!
The Handling of a unique id for the body would be more flexible and entirely sufficient!

Here an example:



In my CSS-File now I can wrote:

#homepage .blog {...}
#homepage .contentheading {...}
#homepage .contenpanopen {...}
...
#news .blog {...}
#news .contentheading {...}
#news .contenpanopen {...}
...

With this id, we can style every element in the body with the reference to unique id!

#homepage #whatever {display: none;}

Do you understand the difference?

It would be really nice, if the developers could notice my advice for the next release.
This little thing it is not very complicated but really effective!

Greetings from Germany,
zabdesign
Last edited by zabdesign on Wed Nov 30, 2005 5:19 pm, edited 1 time in total.

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6569
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: page class suffix - could be more efficient

Post by Jinx » Wed Nov 30, 2005 7:54 pm

The problem is that the body tag is defined in the template by the template designer. If he needs a special body id he can always add it himself.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

Re: page class suffix - could be more efficient

Post by zabdesign » Wed Nov 30, 2005 8:17 pm

Jinx wrote: The problem is that the body tag is defined in the template by the template designer. If he needs a special body id he can always add it himself.
That's right, but why there is a page class suffix, when it's not needed?
Won't it be easier, if there is only 1 id instead of many suffix-classes?

Example:

Code: Select all

<body id="<?php echo $joomla-page-id ?>">
... and there is no need for a page class suffix!

Can you tell me, if there is a global variable which I can use in my templates?

Cheers,
Sebastian

User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6569
Joined: Fri Aug 12, 2005 12:47 am
Contact:

Re: page class suffix - could be more efficient

Post by Jinx » Wed Nov 30, 2005 8:25 pm

U could use the option variable.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

Re: page class suffix - could be more efficient

Post by zabdesign » Wed Nov 30, 2005 8:34 pm

Jinx wrote: U could use the option variable.
Sorry, but I don't know more than before!
What is the "option variable" and where can I find it?
On http://help.joomla.org/ I found nothing about it.

Thank you!
Last edited by zabdesign on Wed Nov 30, 2005 8:36 pm, edited 1 time in total.

User avatar
eyezberg
Joomla! Hero
Joomla! Hero
Posts: 2860
Joined: Thu Aug 25, 2005 5:48 pm
Location: Geneva mostly
Contact:

Re: page class suffix - could be more efficient

Post by eyezberg » Wed Nov 30, 2005 9:08 pm

Browse your site (without SEF enabled!) and look at the URL: it always contains "option=..."
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com

zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

Re: page class suffix - could be more efficient

Post by zabdesign » Thu Dec 01, 2005 9:11 am

eyezberg wrote: Browse your site (without SEF enabled!) and look at the URL: it always contains "option=..."
Ok, I see what you mean! Thank you!
I think to use this variable is not really elegant.

@jinx:
I think you haven't understand what I basically mean!
One unique id for the body makes the page suffix classnames redundant!!!
So the page suffix function has to make only one id in the body tag! Nothing more!

Like all the other template functions (see the placeholders) it has to
be integrated like a basic functionality! Where is the problem?
Is it to innovative? ;)

Did the joomla developers really understand the Cascading of Cascading Style Sheets?
I think they didn't! Otherwise they had implemented only one id!

Maybe you like to read this:
http://www.maxdesign.com.au/presentation/page-id/, a simple examle
http://css-discuss.incutio.com/?page=ClassesVsIds, an article about classes and ids
http://www.w3.org/TR/REC-CSS2/selector.html the W3C specs

If you read the articles, you will really understand the effectiveness behind the idea!

Regards,
Sebastian
Last edited by zabdesign on Thu Dec 01, 2005 9:17 am, edited 1 time in total.

zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

Re: page class suffix - could be more efficient

Post by zabdesign » Thu Dec 01, 2005 9:15 am

eyezberg wrote: Browse your site (without SEF enabled!) and look at the URL: it always contains "option=..."
Ok, I see what you mean! Thank you, ...
but I think to use this variable is not really elegant.

@jinx:
I think you haven't understand what I basically mean!
One unique id for the body makes the page suffix classnames redundant!!!
So the page suffix function has to make only one id in the body tag! Nothing more!

Like all the other template functions (see the placeholders) it has to
be integrated like a basic functionality! Where is the problem?
Is it to innovative? ;)

Did the joomla developers really understand the Cascading of Cascading Style Sheets?
I think they didn't! Otherwise they had implemented only one id!

Maybe you like to read this:
http://www.maxdesign.com.au/presentation/page-id/, a simple examle
http://css-discuss.incutio.com/?page=ClassesVsIds, an article about classes and ids
http://www.w3.org/TR/REC-CSS2/selector.html the W3C specs

If you read the articles, you will really understand them effectiveness behind the idea!

Regards,
Sebastian
Last edited by zabdesign on Thu Dec 01, 2005 9:18 am, edited 1 time in total.

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

Re: page class suffix - could be more efficient

Post by kper » Fri Dec 02, 2005 8:47 am

This sounds like a brilliant idea.

I have been reluctant to use the page class suffix because it just seemed to lead to over-complication and massive CSS bloat.

But does this cascade actually work in all browsers? I have also been plagued by the usual endless differences between what the standards imply and what the browsers can cope with.

zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

Re: page class suffix - could be more efficient

Post by zabdesign » Fri Dec 02, 2005 9:22 am

kper wrote: This sounds like a brilliant idea.
It seems, that you understand my intention! :)
kper wrote: But does this cascade actually work in all browsers?
The cascading is one of the basic concepts of CSS!
I am using the descendent selectors in combination with the id selector on many sites.
I never had any problems with this, and I am usally testing in several browsers on different platforms.

http://www.westciv.com/style_master/aca ... ctors.html
Last edited by zabdesign on Fri Dec 02, 2005 9:27 am, edited 1 time in total.

User avatar
kper
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 26, 2005 11:09 am

Re: page class suffix - could be more efficient

Post by kper » Fri Dec 02, 2005 10:36 am

This is a superb tool for testing almost infinite combinations of browsers and platforms. You can get a free 24-hour trial, but it is not expensive to subscribe in any case.

http://www.browsercam.com/default.aspx

zabdesign
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Nov 30, 2005 4:32 pm

Re: page class suffix - could be more efficient

Post by zabdesign » Fri Dec 02, 2005 12:00 pm

Thank you!
I know browsercam and have already checked out the trial!  ;)
Since now I haven't seen the requirement of buying an account.
I try to save money where I can! There are so many good services and
products outside.

In the meantime I have some basic CSS-Designs which work crossbrowser
and when I have to test some special thing,s I ask my colleagues and other freelancers.

---

I think it won't be easy to convince the joomla developers of implementing the
idea of the body id. I have just talked to a programmer and he said that it is not
easy get the "right" content for this id.
What should be the content?
The navigation title of a site? The section titel? The category title?

I think it would be a great solution, if there would be a combination of
an id and a class!

Code: Select all

<body id="sectiontitle" class="navigation-site-title">
So we have have a maximum control. We can style the css-design of different sections
and also the design of different sites inside each section in dependence of the body
id and the classes.
If there would be a clean implemetation, there could also be the possibility of
a class combination!

Code: Select all

<body id="sectiontitle" class="news newsflash newsflash-id1">
That's possible and works in modern browsers!
(IE 5 - 6, Opera, Netscape, Mozilla, Firefox, Camino, Safari ...)

Hello Developers!!!  :laugh: Do you hear me?

cheers,
Sebastian
Last edited by zabdesign on Thu Jan 19, 2006 3:36 pm, edited 1 time in total.

mikedfunk
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Thu Jan 12, 2006 10:10 pm

Re: page class suffix - could be more efficient

Post by mikedfunk » Thu Jan 19, 2006 3:23 pm

I was going to suggest this when I found this thread. It is really weird that Joomla creates a content suffix but only around the content table. I know you're working on replacing that pointless table, but why don't you (joomla developers) just set the ID of the body tag? The content is still within the body, so you wouldn't even have to change the CSS, as long as you didn't specify table.style . And if you're having trouble with that, why don't you just wrap everything with a div tag set to the id of the page name? This way I could style modules, header and footer, and other page properties outside of the content for each page. If anyone comes out with a mambot or doohicky to do this, please let me know, it would help me tremendously.

Even better would be the ability to set the id to the category name and the class to the page name. But that may be asking for a lot.

pink
Joomla! Apprentice
Joomla! Apprentice
Posts: 32
Joined: Fri Aug 26, 2005 11:12 am
Location: London (but born in Sydney)
Contact:

Re: page class suffix - could be more efficient

Post by pink » Thu Feb 23, 2006 11:49 am

Since first reading this thread I've used the method to put an ID into the body tag. But I really want to add the section name as a class in the body tag. The reason being, is that there is an overview page in more than one section, so the id would be the same, but incorrectly so.

I've been trying to hack the code used in the template.php file that sets up the menu name, but my method of progamming is like carving butter with a chainsaw.

It certainly would be good to have a multi-purpose method of adding a variety of elements in, where you can specifiy whether  it's the item title, the item id, the item's section or the item's category (stripped of spaces and odd characters) that shows up. (or a combination of all!)

J_S
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Thu Oct 04, 2007 9:41 am

Re: page class suffix - could be more efficient

Post by J_S » Fri Oct 19, 2007 10:34 am

I had to insert the menu title like this:

Code: Select all

<body id="<?php

  	function getMenuName()
	{
		global $Itemid;
		$name = getMenu($Itemid);
		$name = ereg_replace('[/ ]', "", strtolower($name));
		return $name;
	}
	
	function getMenu($itemid)
	{
		global $database;
		$sql = "SELECT name FROM #__menu WHERE id='$itemid'";
		$database->setQuery( $sql );
		return $database->loadResult();
	}

echo getMenuName();
?>">


Locked

Return to “Wishlist Archives - Archived”