Tag archive for "template"

Django almost spaceless template tag

Django has a {{ spaceless }} tag that's a little too greedy for my taste. Removing all whitespace between HTML tags can actually change what the browser renders, so here's a less greedy variant. However, it removes all whitespace, not just between tags, so if you use the pre tag ... more

How to add support for navigation menus to your WordPress theme

The new navigation menus system in WordPress 3.0 looks promising, but in my opinion it's not very usable yet. Anyway, here's one way to add navigation menus to your theme while maintaining backward compatibility: In your theme's functions.php add something like the following code: <?php function mytheme_addmenus() { register_nav_menus( array( ... more

Nesting WordPress loops

Sometimes it's useful to put a WordPress loop inside another loop. To do this you'll have to create a new WP_Query object, as in this example: <?php $my_query = new WP_Query( "cat=3" ); if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); the_content(); } } $GLOBALS['post'] = $GLOBALS['wp_query']->post; ... more

Creating a valid WordPress theme

Recently, I've been checking out some of the blogs that link back to me because they use one of my plugins. And it seems like a lot of them are using buggy, incorrect templates. It looks like many WordPress theme developers don't read the theme development checklist. Another fine document ... more

Change Typo3 template depending on column content

Let's assume you don't just want to inject some HTML if there is content in a column, but you want to use a completely different layout. This isn't hard to accomplish, see the example: tmp.templateFile = COA tmp.templateFile { 10 = COA 10 { if.isFalse.numRows < styles.content.getRight 10 = FILE ... more