[Solved] HTML Nugget XHTML Strict compliance - i3theme

Found a bug? Tell us!!
Post Reply
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

[Solved] HTML Nugget XHTML Strict compliance - i3theme

Post by sonichouse »

When I validate my site, I get errors about duplicate id for the following

Code: Select all

<div id="serendipity_html_nugget_plugin"
I have multiple nuggets in my sidebar, so each one would require a unique id e.g

Code: Select all

<div id="serendipity_html_nugget_plugin_001"
I tried to find out where the div was written but failed miserabley.

My idea was to use the internal ID and append that to the id name.

Can someone please tell me where I can change this ?

/Steve
Last edited by sonichouse on Tue Oct 07, 2008 8:19 pm, edited 2 times in total.
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Sidebar.tpl is the culprit:

Code: Select all

{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item}
    {if $item.class == "serendipity_quicksearch_plugin"}
    {else}
    <div id="{$item.class}" class="dbx-box">
        <h3 class="dbx-handle">{$item.title}</h3>
        <div class="dbx-content">{$item.content}</div>
    </div>
    {/if}
{/foreach}
{if $is_raw_mode}
</div>
{/if}
I know that theme uses javascript to drag sidebar items around. Not sure if the script requires that each box ONLY have the class dbx_box or not. This is a more typical example of the sidebar div naming convention:

Code: Select all

<div class="serendipitySideBarItem container_{$item.class}">
I'm a little backed up today so i really do not have time to look into this any further, but hopefully that will give you a head-start until Yellowled, who ported this template to s9y, can get a look at it.
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Thanks Don, that gives me enough to go wandering into pastures new :wink:.

I'll see what I can find.
Steve is occasionally blogging here
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

OK, not the most elegant solution. but this works for me and the w3c validator :lol:

Code: Select all

{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item}
    {if $item.class == "serendipity_quicksearch_plugin"}
    {else}
    <div {if $item.class == "serendipity_html_nugget_plugin"}{else}id="{$item.class}"{/if} class="dbx-box">
        <h3 class="dbx-handle">{$item.title}</h3>
        <div class="dbx-content">{$item.content}</div>
    </div>
    {/if}
{/foreach}
{if $is_raw_mode}
</div>
{/if}
I suppose this will happen for other items that can be stacked.
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Steve - if you are looking for the ID name for each of the nugget to be unique, and are not looking to style them specifically, you could do this to simply append the loop's iteration number to the ID name:

Code: Select all

{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item name=sb}
    {if $item.class == "serendipity_quicksearch_plugin"}
    {else}
    <div id="{$item.class}{if $item.class == "serendipity_html_nugget_plugin"}_{$smarty.foreach.sb.iteration}{/if}" class="dbx-box">
        <h3 class="dbx-handle">{$item.title}</h3>
        <div class="dbx-content">{$item.content}</div>
    </div>
    {/if}
{/foreach}
{if $is_raw_mode}
</div>
{/if}
Note the addition of a name in the foreach loop, and of course the conditional test for the html nugget plugin.

So, if your first html nugget was actually the 3rd plugin item, its ID would be <div id="serendipity_html_nugget_plugin_3" class="dbx_box">. Of course, that number will change based on its position in the list of sidebar plugins, but it will always be unique. Its not any better than what your solution, just different.
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Thanks Don for the insight, this will prove useful somewhere else I am sure.

I think for the moment I will keep what I have (as it works for me).

Steve
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Understandable Steve - hope the idea helps you out in the future. You have been working hard and contributing a lot to the s9y community - I look forward to your future contributions!!
=Don=
Post Reply