HTML Nugget causes validation error

Found a bug? Tell us!!
Post Reply
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

HTML Nugget causes validation error

Post by vincem »

Hi,

I'm not sure this belongs in the Bugs section but in any case, my HTML Nugget sidebar plugins are causing an XHTML validation error because each plugin gets assigned the same

Code: Select all

id="serendipity_html_nugget_plugin"
I've just been looking for the source of that code to see if I could by-pass or change it but can't seem to find it. I assume HMTL Nuggets are not external plugins but part of the core, but... Help!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: HTML Nugget causes validation error

Post by garvinhicking »

Hi!

Which template are you using? Assigning id's would be a matter of the sidebar.tpl file. BOth the default template and bulletproof do not assign ids, so maybe you made a custom change? In that case, you would need to take care of emitting unique id's yourself, maybe by integration a smarty {counter} variable...

Regards,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: HTML Nugget causes validation error

Post by yellowled »

garvinhicking wrote:Which template are you using? Assigning id's would be a matter of the sidebar.tpl file. BOth the default template and bulletproof do not assign ids, so maybe you made a custom change?
That's a customized i3theme. The i3theme's sidebar.tpl also has that, but I'm not sure whether it is actually needed for the i3theme's javascript to work. I'll have to look into that.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: HTML Nugget causes validation error

Post by yellowled »

Yup, documentation of the javascript says that each container must have a unique id.

So the solutions here would be to:

a) not use multiple HTML nuggets

b) find a way to assign a unique id to each HTML nugget through sidebar.tpl, i.e. not using id="{$item.class}

YL
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Re: HTML Nugget causes validation error

Post by vincem »

I'm such a fool! Of course, it was in my template! I am indeed using a modified i3theme and yup, the problem was in sidebar.tpl. I did try to simply remove id="{$item.class} from sidebar.tpl and at first glance, it didn't break anything. But just to be sure, I'd rather still assign a unique id so here's where I'm at:

If I use {$item.id} instead of id="{$item.class}, each plugin is given a unique id however the HTML nuggets now receive an id similar to this: id="@serendipity_html_nugget_plugin:b7518025612f152b6adfa0d5c7d4019f" which still won't validate because an id tag can't start with "@".

So I've been trying to remove the first character (and eventually would tweak it to maybe only use the numbers) but my code below isn't working, some problem with the substr:

Code: Select all

{assign var="uniqueID" value=$item.id|substr:1} 
<div id="{$uniqueID}" class="dbx-box">
My syntax must be flawed...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: HTML Nugget causes validation error

Post by garvinhicking »

Hi!

Code: Select all

<div id="{$item.id|@replace:'@':''}">
?

REgards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Re: HTML Nugget causes validation error

Post by vincem »

Bingo! Thanks, Garvin!
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: HTML Nugget causes validation error

Post by yellowled »

Updated in i3theme via CVS as well.
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Re: HTML Nugget causes validation error

Post by vincem »

Silly me, I hadn't even realized I was getting advice from the source! Thanks Matthias for the help too!
Post Reply