Html skills to pay the bills



  • I can happily say I've inherited a web application that's full of gems like this:

    <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
            <td valign="top">
                <div class="page_title nowrap">
                    <asp:Literal ID="Literal1" runat="server" Text="Title" />
                </div>
            </td>
            <td align="right" valign="top"></td>
        </tr>
    </table>

    Aside from the way it combines attributes and stylesheets to control the appearance, I love how the second table cell aligns absolutely nothing to right and top. And how it uses almost exactly 20 times more markup than it actually needs. I wonder why the creator didn't use nowrap on the table cell that actually contains something?

    It's a bit terse, but I came up with this instead:

    <h3>Title</h3>




  • But what if someone wants to modify that literal from the code? I mean, I'll admit I'm not familiar with the Literal control, but surely the only reason for a control like that is to be able to do stuff with it in the code-behind file?



  • That looks like someone used a crappy WYSIWYG HTML designer to build it. They almost always generate way too much markup to achieve something, and it gets even worse if the author is inexperienced.



  •  Oh yeah.

     <h3 runat="server" id="titleHeading3">Title</h3>

     ftfy.



  •  I don't remember offhand if that actually works, but if it doesn't then this definitely should:

     

    <h3><asp:Literal ID="titleHeading3" Text="Title" runat="server" /></h3>



  • @emurphy said:

    <h3><asp:Literal ID="titleHeading3" Text="Title" runat="server" /></h3>

    I don't get why anyone wants to put executable code inside the HTML. I've been there and done that, but I don't do it no more.

    Someone the other day was advised here to use Mason to make Perl behave like PHP (embed Perl code inside the HTML), when it's PHP that has it completely backwards in the first place. Sure, it's handy now and then to be able to toss up a page from a single script file that has all the HTML and PHP code in, but beyond a single-file test, it's just absurd.



  • @Daniel Beardsmore said:

    I don't get why anyone wants to put executable code inside the HTML. I've been there and done that, but I don't do it no more.

    Someone the other day was advised here to use Mason to make Perl behave like PHP (embed Perl code inside the HTML), when it's PHP that has it completely backwards in the first place. Sure, it's handy now and then to be able to toss up a page from a single script file that has all the HTML and PHP code in, but beyond a single-file test, it's just absurd.

    Um, so your problem is with templating? Obviously you shouldn't be embedding complex logic in a template file, but nobody's saying that.



  • @mott555 said:

    That looks like someone used a crappy WYSIWYG HTML designer to build it. They almost always generate way too much markup to achieve something, and it gets even worse if the author is inexperienced.

    Maybe copy and pasted from a SharePoint 2007 master page. Nothing but pointless nested tables...



  • @Ex-Navy Dude said:

    Maybe copy and pasted from a [ SharePoint 2007 master page | Frontpage Template | web expert using Dreamweaver ]. Nothing but pointless nested tables...

    FTFY.  Most What You See Is What You And Only You Get apps seems to love frenzied table orgies.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.