[pmwiki-users] Divisions, IDs and Styles

Hans hans.bracker at googlemail.com
Thu Aug 10 15:39:12 CDT 2006


On 10/08/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Thu, Aug 10, 2006 at 08:59:29PM +0100, Hans wrote:
> >   } else {
> >       if (!strstr($attr, "id=")) $out .= "<div id='$name' $attr>";
> >       else $out .= "<div $attr>";
> >     $cf[$key] = '</div>';
> >   }
> >   return $out;
> > }

> This produces invalid HTML.  Consider the markup:
>
>     (:div1:)
>     Here's my top-level division.
>     (:div1:)
>     Here's another top-level division
>     (:div1end:)
>
> which produces two <div id='div1'> tags, which won't validate,
> since id= attributes have to be unique within any given HTML document.

Thank you, I can see this clearer now.
The divs don't always need unique numbers, but only when they are nesting.
which may be an attractive concept, but rules out the reuse for unique id names.

I will see if this or my suggestion may be more useful in practise.
Of course by using a unique number for each div I would not get invalid html,
and there are always ways using markup resulting in invalid html.

Thank you for your answers to my other points too!
Makes it a lot clearer for me now.
This nesting capability is really an excellent enhancement of pmwiki, thank you!

It may be good if we write  a page about divs for the documentation.

~Hans




More information about the pmwiki-users mailing list