<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Vayanis &#187; XHTML/CSS</title>
	<atom:link href="http://www.vayanis.com/category/xhtmlcss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vayanis.com</link>
	<description>Developer, Gamer, Thinker</description>
	<lastBuildDate>Wed, 19 May 2010 15:58:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress 2.2&#8217;s &#8211; Link Widget Validation Errors</title>
		<link>http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/</link>
		<comments>http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 05:24:01 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XHTML/CSS]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/</guid>
		<description><![CDATA[Wordpress has really come a long way since I first started using it back when it was version 1.0.  It now has a nice clean admin interface (although I am currently using the tiger style admin), a clean and simple installation script, and my new favorites, dynamic sidebars and widgets.  However, I noticed [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wordpress.org" title="Wordpress homepage">Wordpress</a> has really come a long way since I first started using it back when it was version 1.0.  It now has a nice clean admin interface (although I am currently using the <a href="http://orderedlist.com/wordpress-plugins/wp-tiger-administration/" title="Tiger Style Admin">tiger style admin</a>), a clean and simple installation script, and my new favorites, dynamic sidebars and widgets.  However, I noticed that the default links widget creates invalid XHTML markup.  After a few minutes of looking through the XHTML and widgets.php file, I realized that the culprit was in fact a core wordpress bug.  Currently, wordpress creates widgets with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;li id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;'</span><span style="color: #339933;">,</span></pre></div></div>

<p><span id="more-20"></span></p>
<p>This has the nasty effect of creating widget wrappers according to their widget name due to the &#8220;%1$s&#8221;, which isn&#8217;t a deal until you actually have multiple instances of the same widget; in my case, the links widget.  Having figured out the problem, I began searching for solutions online and stumbled upon the actual Wordpress bug report in <a href="http://trac.wordpress.org/ticket/4287" title="wordpress bug report: 4287">trac</a>.  The proposed solution was to add the following line of code before the call to wp_list_bookmarks() in wp_widget_links():</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$before_widget</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/id=&quot;[^&quot;]*&quot;/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id=&quot;%id&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$before_widget</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Unfortunately, this solution wasn&#8217;t good enough for me because I didn&#8217;t want to have to remember this in case the next Wordpress release didn&#8217;t fix the bug.  So, after some quick thinking I came up with the following bit of code that can be added to any theme&#8217;s function.php file (I think, I am a bit new to Wordpress widgets, in fact, this will be my first).</p>
<p>Edit: This code is actually the exact copy of the widget_links code that ships with wordpress in the widget.php file.  All I did was add the previous fix and moved it into functions.php to create a custom widget.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> widget_my_links<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_db_version</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">,</span> EXTR_SKIP<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wp_db_version</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">3582</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// This ONLY works with li/h2 sidebars.</span>
        get_links_list<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$before_widget</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/id=&quot;[^&quot;]*&quot;/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id=&quot;%id&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$before_widget</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        wp_list_bookmarks<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'title_before'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$before_title</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'title_after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$after_title</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'category_before'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$before_widget</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'category_after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$after_widget</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'show_images'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'linkcat widget'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar_widget'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    register_sidebar_widget<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'My Links'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'widget_my_links'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This should add a custom widget called &#8216;My Links&#8217; when you view the Presentation->Widgets menu.  Replace your current Links Widget with this one, and you should be set to go.  No more invalid markup, at least not from the links widget.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Web Standards &#8211; Not really standard</title>
		<link>http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/</link>
		<comments>http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 21:24:09 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[XHTML/CSS]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/</guid>
		<description><![CDATA[As defined by wikipedia,
Web standards is a general term for the formal standards and other technical specifications that define and describe aspects of the World Wide Web. In recent years, the term has been more frequently associated with the trend of endorsing a set of standardized best practices for building web sites, and a philosophy [...]]]></description>
			<content:encoded><![CDATA[<p>As defined by wikipedia,</p>
<blockquote><p><strong>Web standards</strong> is a general term for the formal <a href="http://en.wikipedia.org/wiki/Internet_standard" title="Internet standard">standards</a> and other technical <a href="http://en.wikipedia.org/wiki/Specification" title="Specification">specifications</a> that define and describe aspects of the <a href="http://en.wikipedia.org/wiki/World_Wide_Web" title="World Wide Web">World Wide Web</a>. In recent years, the term has been more frequently associated with the trend of endorsing a set of standardized <a href="http://en.wikipedia.org/wiki/Best_practices" title="Best practices">best practices</a> for building <a href="http://en.wikipedia.org/wiki/Web_site" title="Web site">web sites</a>, and a philosophy of <a href="http://en.wikipedia.org/wiki/Web_design" title="Web design">web design</a> and development that includes those methods.</p></blockquote>
<p>I have been a proponent of Web standards ever since I created my first web site back in early 2000.  Back then, I was only following what I thought was the correct way to do things, and having the word &#8217;standards&#8217; seemed to make this <em>movement</em> official for me. As I learned more about these web standards, the importance of the best practices set forth along with the concept and goals of creating markup that would display the same across browsers, the more it all seemed to make sense.</p>
<p>However, seven years later, I am still creating web sites/applications using PHP, XHTML and CSS, but I am getting ever so frustrated with these so called <em>&#8220;web standards,&#8221; </em>mainly due to the quirks and lack of support in IE6 and to some degree IE7.  I am not an XHTML or CSS guru, but I think I know enough to write decent markup and styles to be effective (please don&#8217;t judge me using this site, after all, this theme was found on a wordpress theme site and I haven&#8217;t had the time to clean it up).  Just the other day, I was working on a site that required a three column layout, with columns of equal height, so I decided to use alistapart&#8217;s <a href="http://www.alistapart.com/articles/holygrail" title="Holy Grail">Holy Grail</a>.</p>
<p><span id="more-17"></span></p>
<p>This worked great in Firefox, Safari, IE6/7 and even Opera, until I tried to accomplish my next task, adding a picture gallery created by floated elements.  As most of you might have guessed, everything was fine except with IE6.  Now why is it that I always have to find ways to hack my styles just to get them to work with IE6 or 7?  Why can&#8217;t Microsoft finally create a decent browser.  Well, on this day, I had had enough. I decided to scrap the <em>Holy Grail</em> layout and create my three columns using a table.  Yes, thats right, I used a table layout to accomplish my three columns and it worked great.  Not to mention I got it done without any hassles from any of the browsers I was testing with.
<p>Before anyone begins the flaming, I will start by stating that I know this isn&#8217;t semantic. I also know that this use of tables is deemed inappropriate by the w3c whom states:</p>
<blockquote><p>Tables should not be used purely as a means to layout document content   as this may present problems when rendering to non-visual media. Additionally,   when used with graphics, these tables may force users to scroll horizontally   to view a table designed on a system with a larger display. To minimize these   problems, authors should use style sheets to control layout rather than tables.</p></blockquote>
<p>I merely decided to save myself the agony of debugging IE6/7 issues. I still support web standards, but I don&#8217;t see how it is completely feasible to follow them blindly when we all know well and good that the most prevalent browser used worldwide, just doesn&#8217;t fully support them.  Until these set of best practices are adopted by all the major browsers, to their full extent, they will never be more than best practices, and even then the term will be somewhat misleading.</p>
<p>Maybe I have been a bit slow to come to this conclusion, after all, most things can be successfully conquered utilizing web standard, but I am not the first to point out its flaws.  Of course these really aren&#8217;t flaws of the standards set forth, but rather one prominent browser that fails to adhere to them.  As a young developer, and as a developer who plans to be in this field for a good portion of his working career, what can I do to further along the goals of standardizing XHTML/CSS best practices?  What is the rest of the community doing? And how well is it going?</p>
<p><em>Sorry for the rambling, but I have a dream&#8230; A dream that one day, all browsers will be created equal and all developers will blissfully enjoy writing clean concise markup and all users will see the same beautiful interface into what we call the world wide web.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
