FAHNZ

MODE

Jul 31 2009

Why Are We Coding for IE6 Again?

Internet Explorer 6 sucks. We all know it. We all hate it. We all Most of us still have to deal with it. This is a problem I had run into before and it took me forever to figure out how to solve it this time. May as well document it here so I (and hopefully anyone else) can find it easily next time.

The problem:
Links styled with a background image are incorrectly tiling that background image. Or to put it another way; IE6 is not properly rendering the background of an inline element has a no-repeat background set. The example below shows the same link style applied in different places on the same page. As you can see, it renders the area for the background image position and dimension correctly, but it repeats the image within the confines of the actual arrow image dimensions (where it should show up). Man, that’s weird to try to explain. Hopefully the image below helps.

The problem shown:

Examples of IE6 background repeat and positioning problem

The CSS code:

.more-link {
 padding-right: 15px;
 font-weight: bold;
 text-transform: uppercase;
 background: url(../images/common/readmore-arrow.gif) 100% 1px no-repeat;
}

The HTML code:

<a href="#">View more</a>

The solution:
The solution is stupidly simple. I had figured it out before on a previous project, but of course couldn’t remember what the solution was. I just remembered it was something simple to implement. Anyway, as I emphasized above, the problem seems to be that the no-repeat background is set on an inline element. I guess that confuses IE6. Go figure. The browser is coming up on being a decade old.

The solution shown:

IE6 inline background problem - fixed

The updated CSS code:

.more-link {
 display: inline-block;
 padding-right: 15px;
 font-weight: bold;
 text-transform: uppercase;
 background: url(../images/common/readmore-arrow.gif) 100% 1px no-repeat;
}

Voila! Tell IE to keep the element inline, but treat it like a block. Plus it shouldn’t adversely affect other browsers. Problem solved.


Jul 8 2009

WordPress Default (Kubrick) Template Reference

In modifying the default “Kubrick” theme for WordPress, I didn’t find a concise reference for all the files in the theme directory, so I put one together:

WIDE (SINGLE) COLUMN PAGES
404.php            wide-column standard "Not Found" error page
archives.php        wide-column archives listing page, by month and by category
comments-popup.php    full-page used for when the option to have comments area popup in a new window (not turned on by default) (http://codex.wordpress.org/FAQ_Working_with_WordPress#Can_I_have_popup_comments.3F)
image.php        wide-column page used for viewing a "linked-to" image resource (supercedes generic attachement.php)
links.php        wide-column links (bookmarks) listing page (ignores page content if chosed as the template to use in the admin section)
single.php        wide-column page used to display a single post with comments area

NARROW (TWO) COLUMN PAGES
archive.php        narrow-column archive view page, shows filtered archive view (ex: by month or category)
index.php        narrow-column root template file, used for everything if other page templates are not present
page.php        narrow-column page used for "pages" created in the admin section
search.php        narrow-column page used to display search results

INCLUDES
comments.php        used for inserting comments area and functionality into pages, present in image.php, index.php, single.php
footer.php        global footer (includes closing tags started in header.php)
header.php        global header (includes opening tags closed in footer.php)
searchform.php        optional include that will be used for search form template, used in sidebar and on search.php
sidebar.php        global right-side column, includes search form and list-based navigation elements

OTHER
functions.php        optional global PHP functions automatically loaded by WordPress if present

This is probably out there somewhere already, but hopefully this will come in handy for someone else as well.


Jul 6 2009

ASP.NET Membership Woes

The problem:

I kept on getting foreign key constraint errors when trying to use ASP.NET (2.0) DeleteUser method:

Membership.DeleteUser(<username>);

All my research on the internet pointed to it being a permissions problem. Like many of the posts I found, this worked fine in my local development database, but in production it would yield this error:

The DELETE statement conflicted with the REFERENCE  constraint
"FK__aspnet_Me__UserI__15502E78". The conflict occurred in  database
"dbname", table "dbo.aspnet_Membership", column 'UserId'.
The  statement has been terminated.

After hours of experimentation with user permissions in the database and research on the problem, the support team at the hosting company I was working with found the solution of setting the references foreign key constraints to cascade upon deletion. I went into SQL Server Management Studio and updated the FKs that were referenced in the errors to cascade upon deletion and voila! Problem solved. Good job CrystalTech support and especially Geoff.

Update: I looked into my local database (that has been working properly) and saw that the foreign keys are not set to cascade deletions, so it still may be some strange permissions issue. Regardless, this seems like an acceptable workaround and it did get those deletions to work (and the usernames freed up).