Support » Plugins » My WP-dTree fails to validate as XHTML 1.0 Transitional

  • If I replace this:

    wp_list_cats(‘optioncount=1&hierarchical=1’);

    with this:

    if (function_exists(‘wp_dtree_get_categories’))
    {
    wp_dtree_get_categories();
    }
    else
    {
    wp_list_cats(‘optioncount=1&hierarchical=1’);
    }

    etc. in my sidebar.php, as per your readme file, I get a validation error. The site is http://www.ostrogothia.com . The validator link is in the page footer. If I disable the plugin, the pages validate ok.

    I’m running version 3.4 of WP-dTree and 2.6 of WP.

    I really like the functionality as I plan to have plenty of pages in a hierarchy on one of my sites.

    Thanks,
    Arto Jarvinen, Vreta kloster, Sweden

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Arto, and thanks! Here’s what you can do to help:

    First: please use the widgets to output the trees you need. (Design->Widgets->WP-dTree […])

    Second: read up on the changes jberghem contributed for XHTML validation. Add, change or improve whatever you deem necessary.

    Third: test them and then send your findings my way. 🙂

    Ok, thanks, I’ll give it a try. I’m after all on vacation. It seems as if the sidebar framework (where ever that is, I’m not at all familiar with the code) expects everything to be in an un-numbered list and adds
    ul and li tags as it sees appropriate. The validator does not like your tags within such a list. Neither does it like that you (or WP) puts <p> inside <span>.

    I have a hacked a static html page that looks fine in FF and that validates. Now I just need to get WP and your widgets to generate a page like that 🙂

    Arto

    This is as far as I get: I gave up the widget track for the time being and just edited my sidebar.php according to your readme-file. The widgets have their idiosyncrasies that don’t seem to validate with the output from wp-dtree (see previous post).

    Even so, I can’t get the pages to validate due to two remaining offending constructs generated by wp-dtree. The first one is:

    <span id="dtreepgewrapper">
    <p id="oclink"><a href="javascript: p.openAll();">Expand all</a> | <a href="javascript: p.closeAll();">Collapse all</a>
    
    [snip]
    </span>

    The validator says you can’t put p’s inside span’s.

    The second offending construct is the multiple definition of the id “oclink”. It should be unique according to the validator. For more details, please check out the validator output yourself.

    In my static html hack, that both validates and works fine, I simply removed the <p id="oclink">...</p> structure.

    I have tried to find the piece of code that generates the offending statement but failed. I came all the way to the following statement

    $pgeresults = $wpdb->get_var("SELECT content FROM ". $wp_dtree_cache . " WHERE treetype = 'pge' ORDER BY id");

    in the file wp_dtree_pge_functions.php (and probably the files for categories etc too). It seems that the tags are returned in $pgeresults and thus reside in the database.

    Could you pls give me a hint as to where exactly the offending HTML is generated and put into the database (if indeed it is there) and I’ll give it another try.

    Again, the pages can be found at http://www.ostrogothia.com

    Thanks!

    Arto

    I appreciate you taking the time to help out! I should’ve told you earlier: you must make sure to refresh the WP-dTree cache before evaluating any of your changes! (updated when you: add/delete a post, enable/disable the plugin or simply hit “Apply settings” in the plugin configuration screen).

    The validator says you can’t put p’s inside span’s

    jberghem contributed that change; they were previously ul-elements. By all means change it back or try whatever you can come up with.

    As for the oclinks – here’s how the plugin is constructed:
    Each tree data is gathered in their respective wp-dtree_[xxx]-functions.php, and then “compiled” to the common tree structure in wp-dtree_gen-functions.php.

    Open/Close All-links are common for all trees, and thus generated in gen-functions.php (line 25). If tag IDs must be unique, try making them a class instead (and edit wp-style.php to reflect the change).

    The widgets are generated ni the “main” file: wp-dtree.php -> wp_dtree_init_widgets() (line 138), and they’re very straightforward to understand: WordPress prints a couple of mandatory tags (probably defined by the current theme and template); and in between them I output what I need.

    Please – if you make this validate, take another look at the widgets too – it would help a lot of users!

    Again: thank you for helping out! I do recognise the importance of clean output and validation, but I guess we all produce to scratch an itch. I’m not a (serious) web developer and thus, validation (…and design) has never been my itch. 🙂

    Now my immediate itch is gone 🙂 i.e. my pages look as I want them to and they validate, both CSS and XHTML 1.0 Transitional. I wasn’t such a nitpicker with validation either until a friend gave me hard time about it (especially the fact that I had left the WP “Validate XHTML” link there without seeing to it that the pages actually validated). Valid code is a good thing promote. Otherwise some unnamed big players will create their own proprietary standards.

    I did this fix the manual way (w/o widgets) by editing the sidebar.php. I had already gone that way before since it gives me better control of what I show in the sidebar, for instance what goes under my Meta section. I’ll look at the widget way later.

    This is what I did:

    – Removed <p id=\"oclink\">...</p> from the wp_dtree_build_tree function in wp_dtree_gen-functions.php.
    – Added margin: 3px 0px 0px 0px; to the #dtreec, #dtreea, … style in style.php to add some space between the open / close links and the tree. I tried adding a class to the open / close links but probably because they are displayed inline, I couldn’t get the browser to recognize my styles for that class at all. It’s not important at least in my theme though. It all displays just like I want it to.
    – I also removed all ul li from the part of my sidebar.php that includes the trees just to have a cleaner sheet to experiment with. They are not really needed (again, not at least in my theme). I’ll try to restore everything for the widget way later.

    Take care!

    Arto

    The changes above seem to work with widgets and the original sidebar.php (with the ul li structure) of the theme too. Check it out at http://www.ostrogothia.com . It is running all your widgets in the sidebar now. And it validates according to my latest post 🙂

    Cheers!

    Arto

    Confirmed: both my dev sites (default Kubrik theme) validates on CSS and XHTML 1.0 Transitional.

    I felt this was important enough to warrant a bump in the version number so WordPress can notify users. Current is: 3.4.1

    Thanks again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘My WP-dTree fails to validate as XHTML 1.0 Transitional’ is closed to new replies.