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 » Sun May 31, 2009 5:14 am

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!

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: HTML Nugget causes validation error

Post by garvinhicking » Sun May 31, 2009 2:12 pm

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/

User avatar
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 » Sun May 31, 2009 3:18 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
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 » Sun May 31, 2009 3:22 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: HTML Nugget causes validation error

Post by vincem » Sun May 31, 2009 7:16 pm

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...

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: HTML Nugget causes validation error

Post by garvinhicking » Sun May 31, 2009 7:38 pm

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 » Sun May 31, 2009 7:44 pm

Bingo! Thanks, Garvin!

User avatar
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 » Sun May 31, 2009 10:04 pm

Updated in i3theme via CVS as well.
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: HTML Nugget causes validation error

Post by vincem » Sun May 31, 2009 11:43 pm

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

Post Reply