Page 1 of 1

Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 9:02 am
by seraphyn
Hi,

I don't know if it's a bug or an PEBKAC.
I'm using to HTML-Nuggets for selfwritten text in my sidebar at the bottom and the Validator gives me an:
Line 910, Column 14: ID "serendipity_html_nugget_plugin" already defined
<div id="serendipity_html_nugget_plugin" class="sbitem">

An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
Line 900, Column 14: ID "serendipity_html_nugget_plugin" first defined here
<div id="serendipity_html_nugget_plugin" class="sbitem">
One is for Textinformation and one for links.
If it's not my fault could it be possible to generate one more class with the title shortened for the item?

Thx in advance
chris

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 11:52 am
by garvinhicking
Hi!

Which template are you using? This is happening because in the sidebar.tpl file of your template a ID is given, probably to support specific styling of special plugin outputs. Since the nugget plugin can be used multiple times, that causes a problem.

It would be better to apply the unique styling through a div.class instead of div.id...

Regards,
Garvin

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 1:54 pm
by seraphyn
ahhh, I'll have a look.
Selfwritten Template.
In this case PEBKAC...:)
Thx

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 2:04 pm
by seraphyn

Code: Select all

#sidebar_top .sbitem {
float:left;
width: 48%;
margin: 5px;
}
Using this code and more not.
does this one provides the error?

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 3:29 pm
by yellowled
garvinhicking wrote:It would be better to apply the unique styling through a div.class instead of div.id...
Another possibility is to assign unique ids to HTML nuggets in the sidebar.tpl using a smarty counter, but that's usually only desirable if various nuggets need individual styling. Also note that multiple instances of the same id are invalid HTML, so Garvin's class suggestion is really the better idea.

YL

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 3:33 pm
by seraphyn
But the ID is from placing the plugin in the administratorpage?
Isn't it?
greetings
chris

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 4:22 pm
by yellowled
seraphyn wrote:But the ID is from placing the plugin in the administratorpage?
No. If this

Code: Select all

<div id="serendipity_html_nugget_plugin" class="sbitem">
is the result, it's very likely your sidebar.tpl has something like this in it:

Code: Select all

<div id="{$item.class}" class="sbitem">
That's fine as long as you don't have any plugins in the sidebar which allow multiple instances like the HTML nugget plugin. I used to use similar code in my blog, but I didn't use HTML nuggets. As the name of the variable indicates, $item.class is supposed to be assigned as a class, not an id.

YL

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 6:32 pm
by seraphyn
Ahhhh, Okay.
So I need to change this...
Thanks

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 7:21 pm
by seraphyn
Works :)
Thanks, hope that I finish this theme until the next 2 months.
Greetings Chris

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 8:44 pm
by yellowled
seraphyn wrote:Thanks, hope that I finish this theme until the next 2 months.
Don't forget to show it off in the Showcase or Themes (if you make a public release) forum. :)

YL

Re: Using two HTMl-Nuggets makes page invalid

Posted: Mon Jun 06, 2011 8:50 pm
by seraphyn
Should be a public release.
But that what would like to do ain't to be easy, but I'm a perfectionist lol.
At the moment I'm fighting with the CSS3 floats etc... but I see a light at the end of the tunnel and this ain't to be a train... hope so lol