Page 1 of 1

HTML Nugget causes validation error

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

Re: HTML Nugget causes validation error

Posted: Sun May 31, 2009 2:12 pm
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

Re: HTML Nugget causes validation error

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

Re: HTML Nugget causes validation error

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

Re: HTML Nugget causes validation error

Posted: Sun May 31, 2009 7:16 pm
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...

Re: HTML Nugget causes validation error

Posted: Sun May 31, 2009 7:38 pm
by garvinhicking
Hi!

Code: Select all

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

REgards,
Garvin

Re: HTML Nugget causes validation error

Posted: Sun May 31, 2009 7:44 pm
by vincem
Bingo! Thanks, Garvin!

Re: HTML Nugget causes validation error

Posted: Sun May 31, 2009 10:04 pm
by yellowled
Updated in i3theme via CVS as well.

Re: HTML Nugget causes validation error

Posted: Sun May 31, 2009 11:43 pm
by vincem
Silly me, I hadn't even realized I was getting advice from the source! Thanks Matthias for the help too!