willoller.com

Avatar

Learning to match the beat of the Old World man.

Textile ol li count bug

Just hit a bug with the Textile 2.0 library:


# Portland, OR
# Sanford, FL
# Albuquerque, NM
# San Diego, CA
# Bellingham, WA
 

Was producing:


<ol>
   <li>Portland, OR</li>
   <li>Sanford, FL</li>
   <li>Albuquerque, NM</li>
   <li>San Diego, CA   </li>
</ol>
<ol>
   <li>Bellingham, WA</li>
</ol>
 

Found the solution here:

You can work around the problem, by replacing these two lines (in the fList function in /textpattern/lib/classTextile.php):

foreach($text as $line) {
  $nextline = next($text);

 
with:

foreach($text as $nr => $line) {
  $nextline = isset($text[$nr+1]) ? $text[$nr+1] : false;

 

Generating amazing reports using Basecamp (Part 1 – Tagging)

We’ve been looking for good ways to produce advanced reports using Basecamp. We have hit upon a system in which we implement a rudimentary tagging system, and add additional metadata for time estimation.

In this first part, I will explain the simple tagging system. Next time, I will tell you all about the Big XML Dump.

Tagging System

Tagging will be implemented using { curly braces } around a comma-delimited list. We will be using our regular work categories as tags, so a typical todo-list might look like:

Implement new feature {Programming}

  • Add new processing loop
  • Create new template {HTML Production}
  • Connect to pre-existing API

We want our tagging parser to be smart, and change an item’s tag list on the fly based on it’s parent item’s tag list. That sounds complicated; here’s an example using the list above.

Computed Tags


Implement new feature {Programming}

  • Add new processing loop {Programming}
  • Create new template {Programming, HTML Production}
  • Connect to pre-existing API {Programming}

The italicized tags are derived from the list’s name (Implement new feature) and will be programmatically added.

Time Estimation

Time estimates are handled in much the same way as the tags, just using straight brackets instead ([, ]).

Adding time estimation to our list:

Implement new feature {Programming}

  • Add new processing loop [1]
  • Create new template [6.5] {HTML Production}
  • Connect to pre-existing API [9]

This way, each todo-item has a time value associated with it. We will use this data later on to test our estimation skills and to quantify our productivity.

Next: Part 2 – The Big XML Dump

Limiting title and excerpt length with WordPress

Sometimes clients have very specific requirements. Sometimes they want autometic controls on simple things they have total control over anyway. I digress.

In this case, blog titles needed to be of any length, but have their lengths truncated under certain circumstances. Furthermore, excerpts need to be able to be the default length (50 words), but shorter (10 words) under those same certain circumstances.

Fortunately for me, the excerpt was easily fixed using a plugin called the excerpt reloaded.

http://guff.szub.net/2005/02/26/the-excerpt-reloaded/

Next, for the title length requirements, you will need to modifiy a core file: wp-includes/post-template.php.

[php]
function the_title($before = ‘’, $after = ‘’, $echo = true, $length = false) { $title = get_the_title(); if ( $length && is_numeric($length) ) { $title = substr( $title, 0, $length ); } if ( strlen($title) > 0 ) { $title = apply_filters(‘the_title’, $before . $title . $after, $before, $after); if ( $echo ) echo $title; else return $title; }
}
[/php]

Finally, when in The Loop, call the_title() like this:

[php]< ?php the_title('', '', true, '40') ?>[/php]

Now, the title will be a mere 40 characters long, and the excerpt (using the_excerpt_reloaded()) can be any desired length.

fuser

A quick blurb about the most useful command you practically never use.

Continue

Before you go