Page 1 of 1

[Solved] HTML Nugget XHTML Strict compliance - i3theme

Posted: Mon Sep 29, 2008 10:35 pm
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

Posted: Mon Sep 29, 2008 10:56 pm
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.

Posted: Mon Sep 29, 2008 10:59 pm
by sonichouse
Thanks Don, that gives me enough to go wandering into pastures new :wink:.

I'll see what I can find.

Posted: Tue Oct 07, 2008 8:04 pm
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.

Posted: Tue Oct 07, 2008 8:36 pm
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.

Posted: Tue Oct 07, 2008 9:05 pm
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

Posted: Wed Oct 08, 2008 5:32 am
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!!