Archive for Code

WordPress 2.5 Features Big Admin Changes

// March 18th, 2008 // No Comments » // Code

Similar to how 2.3 overhauled the tagging, category and classification system, version 2.5 of WordPress will overhaul the admin area.

More than just a visual overhaul (which was needed), WordPress 2.5 will feature better admin functionality and an improved user interface thanks in part to Happy Cog.

There’s a nice article on WordPress.org detailing the work that went into the new Admin interface. Check it out.

The features that worry me the most are:

  • Multi-file uploads.
  • New “Media Manager” for images, audio, video, etc.
  • Built-in gallery function.
  • Built-in (and pluggable) Gravatars support.
  • I’ve achieved all of those using plug-ins and custom PHP files. Seeing that list of features makes me wonder how it will affect my plugins and if I’ll need to re-do several sites to support the “out-of-the-box” features to stay compatible with WP 2.5.

    Internet Explorer 8 Introduces WebSlices

    // March 6th, 2008 // No Comments » // Code

    Why, Microsoft, why? That’s all I ask. Why must you continue to introduce proprietary technology in Internet Explorer?

    Internet Explorer 8 Beta is now available for download and one of the new features is WebSlices. By adding a few specific class names to content blocks, IE will essentially syndicate the content.

    <code><div class=”hslice” id=”1”>
      <p class=”entry-title”>item – $66.00</p>
      <div class=”entry-content”>high bidder:buyer1
        …
      </div>
    </div>

    Using the above classes will generate content the user (or IE8 user) can subscribe too. Why not RSS? Is it because that’s compatible with other software, browsers, and readers. Microsoft wanted something that would just work for Internet Explorer.

    Do they honestly thing any developer will support or use this? Hmm… let’s see… I can create a RSS feed for my content that anyone can use (even IE7 and IE8 users) or I can create the WebSlice just for IE8 users. The only use this will get will be from FrontPage/Expression users who do not know any better.

    Even Microsoft says it’s just like RSS on their site:

    WebSlices behave just like feeds where clients can subscribe to get updates and notify the user of changes.

    Please Microsoft, just make a good, fast browser for people to use. I was willing to admit IE7 was a step in the right direction. It’s fast and renders content relatively well and has good CSS support. It was only a matter of time before they had to go and ruin it.

    DotNetNuke No Search Results Message

    // March 5th, 2008 // 7 Comments » // Code

    I’ve finally deployed the DotNetNuke site I’ve been working on. After deployment is when the most obvious things pop up.

    For instance, in DotNetNuke when you search for something in the site it will return a list of links to what it finds. What it won’t do is display something friendly like “No Search Results Found” if it doesn’t find anything. Dumb and not very user friendly.

    I did find what I thought would be the solution at ecktwo, but it didn’t work in Firefox due to the

    document.getElementById("search").innerHTML

    which doesn’t work in Firefox within a table, which is what the Search Results are generated using the ASP.NET grid view. So, I thought I’d take a stab at building something that worked for both IE and Firefox.

    Make a copy of your admin\Search\SearchResults.ascx file and then open the file in notepad. Apply the following code that I’ve highlighted in red:

    <%@ Control Language=”vb” AutoEventWireup=”false” Explicit=”True” Inherits=”DotNetNuke.Modules.SearchResults.SearchResults” CodeFile=”SearchResults.ascx.vb” %>

    <asp:Datagrid id=”dgResults” runat=”server” AutoGenerateColumns=”False” AllowPaging=”True” BorderStyle=”None”
    PagerStyle-CssClass=”NormalBold” ShowHeader=”False” CellPadding=”4″ GridLines=”None”>
    <Columns>
    <asp:TemplateColumn>
    <ItemTemplate>
    <asp:Label id=lblNo runat=”server” Text=’<%# DataBinder.Eval(Container, “ItemIndex”) + 1 %>’ CssClass=”SubHead”>
    </asp:Label>
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn>
    <ItemTemplate>
    <asp:HyperLink id=”lnkTitle” runat=”server” Name=”result” CssClass=”SubHead” NavigateUrl=’<%# FormatURL(DataBinder.Eval(Container.DataItem,”TabId”),
    DataBinder.Eval(Container.DataItem,”Guid”)) %>’ Text=’<%# DataBinder.Eval(Container.DataItem, “Title”) %>’>
    </asp:HyperLink>&nbsp;-
    <asp:Label id=”lblRelevance” runat=”server” CssClass=”Normal” Text=’<%# FormatRelevance(DataBinder.Eval(Container.DataItem, “Relevance”)) %>’ >
    </asp:Label><BR>
    <asp:Label id=”lblSummary” runat=”server” CssClass=”Normal” Text=’<%# DataBinder.Eval(Container.DataItem, “Description”) + “<br>” %>’ Visible=”<%# ShowDescription() %>”>
    </asp:Label>
    <asp:HyperLink id=”lnkLink” runat=”server” CssClass=”CommandButton” NavigateUrl=’<%# FormatURL(DataBinder.Eval(Container.DataItem,”TabId”),
    DataBinder.Eval(Container.DataItem,”Guid”)) %>’ Text=’<%# FormatURL(DataBinder.Eval(Container.DataItem,”TabId”),
    DataBinder.Eval(Container.DataItem,”Guid”)) %>’>
    </asp:HyperLink>&nbsp;-
    <asp:Label id=”lblPubDate” runat=”server” CssClass=”Normal” Text=’<%# FormatDate(DataBinder.Eval(Container.DataItem, “PubDate”)) %>’>
    </asp:Label>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    <PagerStyle CssClass=”NormalBold” Mode=”NumericPages”></PagerStyle>
    </asp:Datagrid>

    <div id=”NoResults”>
    <h3 class=”red” style=”text-align:center”>No Search Results Found</h3>
    </div>
    <script language =”Javascript”>
    var search;
    search = document.getElementsByName(“result”);

    if (search.length == 0) {
    document.getElementById(“NoResults”).style.display=’block’;
    }
    else {
    document.getElementById(“NoResults”).style.display=’none’;
    }
    </script>

    Be sure to add the Name=”result” snippet to the asp:Hyperlink in the code above. It’s easy to miss.

    Save that and you should now have a spiffy new message displayed when no results are found. Use whatever CSS you want to style the message.

    Multiple Versions of IE on Win XP

    // January 7th, 2008 // No Comments » // Code

    Multiple IE is a great little free program that lets you run multiple versions of Microsoft Internet Explorer along with version 7 of Internet Explorer.

    The previous version I used to check IE6 used a Virtual PC and was a memory hog. This method worked perfectly and much faster and lets you test all the way back to Internet Explorer 3 (if you so desire).

    WordPress Super Cache and Local Analytics

    // November 9th, 2007 // No Comments » // Code

    Two nice WordPress plugins were released this week that might be of use to some.

    First up is Local Analytics. This plugin caches the urchin.js file on your local server, allowing  faster loading of the script. It also adds an admin configurable host of options that allow better tracking of outgoing links, downloaded files, and email address links. Definitely worth a try if you like Google Analytics (and you should).

    Next up is the WordPress Super Cache plugin. Heavily modifying the WP-Cache 2 plugin, Donncha O Caoimh has created another great plugin for WordPress. If you’ve got a lot of traffic and fairly static content, it might be just the thing you’re looking for. Comments suggest there might be issues with AJAX or other interactive features. So try it out and see how it works.

    Unfortunately, I’ll have to wait on Super Cache. Despite a nice modification to use the plugin on a Windows IIS or Apache server, it still requires the ISAPI_Rewrite 3.0 package for use on Windows servers. With most of my work involving .NET development now and the site up and running fine on WordPress, maybe I should migrate to a PHP account?

    Memory Size Bytes Exhausted Error

    // September 28th, 2007 // No Comments » // Code, Web

    A big thanks to TechTracer for pointing me in the right direction for a frustrating WordPress error.

    After upgrading to WordPress 2.3 (fairly painless, despite the major changes due to “tag” implementation) I couldn’t upload images. Any image over 100K would produce an error stating: Allowed memory size of 16388608 bytes exhausted (tried to allocate 6400 bytes). It also made reference to the includes\image.php file.

    After reading the TechTracer post, I added one line of code just after the <? php tag in the image.php file:

    ini_set(‘memory_limit’,'32M’);

    The additional functions in WordPress (tags) and the plug-ins that I’m running must max out the memory. Now, I can upload my images and WordPress will resize and generate thumbnails just like it should (using the excellent Flexible Upload plug-in, that is).

    Smashing Magazine’s 10 Usability Nightmares

    // September 27th, 2007 // No Comments » // Code, Web

    Smashing Magazine has posted 10 Usability Nightmares You Should Be Aware of and it’s a great read. Several things in there that all developers have probably been guilty of at one time or another. Read it and then try to remove as much of them from your sites as you can.

    Smashing Magazine also provided a list of 8 Usability Checkpoints as well. Just read the article for more info on each one listed below.

    1. You don’t use pop-ups.
    2. You don’t change users’ window size.
    3. You don’t use too small font sizes.
    4. You don’t have unclear link text.
    5. You don’t have dead links.
    6. You have at most one animation per page.
    7. You make it easy to contact you.
    8. Your links open in the same window.

    Wordpress 2.3 New Features

    // September 21st, 2007 // No Comments » // Code, Web

    WordPress 2.3 is right around the corner. Schedule for release on Sept. 24, it has several nice, new features. To get up to speed, I’d recommend reading 10 Things You Need to Know About WordPress 2.3. It’s the first article I’ve seen that sums up all the work and changes from 2.2 to 2.3 in an easy to understand format.

    The most notable change is the support for “tagging” posts. Similar to Flickr and other sites, posts will not have categories and can also be tagged with more general relationships. This addition changes the structure of the WP database and could possibly break some of you favorite WP plug-ins.

    I’ve installed Release Candidate 1 on another site and the only casualty was the excellent Extended Live Archive plug-in. I doubt the problem will be fixed, since the plug-in has seen little activity. Maybe someone will come along with something similar for 2.3.

    Post Like a Pirate

    // September 19th, 2007 // 1 Comment » // Code, Web

    Thanks to Dougal Campbell’s Text-Filter-Suite, all the posts on the site should be formatted in “pirate speak” in honor of International Talk Like A Pirate Day. Everything should resume to normal tomorrow. Now go talk like a pirate.

    FCK Editor Revisited – Adding a Custom Link Style

    // September 19th, 2007 // 2 Comments » // Code, Web

    I’ve had a few questions/comments on using Custom Styles with FCK Editor, so here’s a style that I created that will format any link you apply it to as a red button that changes color on mouse over.

    Add this CSS to the fck.css and portal.css files in you PORTALS folder.

    /* Both variations --a.color-- and --span.color a--
        are needed to handle DNN's span applications
        not being consistent */
    
    .red_button, a.red_button:link, a.red_button:visited,
     span.red_button a, span.red_button a:link,
     span.red_button a:visited {
            font-weight: bold;
    	font-size:10px;
    	color: #FFF;
    	background-color:#C00;
    	padding:4px 8px;
    	text-decoration: none;
    	border-top: 1px solid #DFDFDF;
    	border-left: 1px solid #DFDFDF;
    	border-bottom: 1px solid #333;
    	border-right: 1px solid #333;
    	}
    
    a:hover span.red_button,
    span.red_button a:hover {
    	background-color:#900;
    	border-top: 1px #31557f solid;
    	border-left: 1px #31557f solid;
    	border-bottom: 1px #666666 solid;
    	border-right: 1px #666666 solid;
    	text-decoration:none
    }

    Be sure to add the following to the fck.xml file, to append the style to the menu in the FCK editor.

    <Style name="red_button" element="span">
      <Attribute name="class" value="red_button" />
    </Style>

    Hope this helps, post any questions in the comments.