paul bennett

Archive for the ‘frameworks’ Category

It has somewhat of a steep learning curve, but Drupal is amazing for allowing you to build flexible, complex websites with lots of functionality in very little time.

For a site I’m working on, we had several custom content types coming through the default node template (node.tpl.php) in our customised theme.

This was fine and dandy for quick development, but then the time came to customise the node page for each content type.

First things first, you need a custom node template. Save the node.tpl.php file as node-[your node name].tpl.php and you’ve created a custom node template. (This means if your node type is ‘audio’, you’d save the file as node-audio.tpl.php)

Now we need to customise the template to suit our needs.

If you dive into a standard node template you’ll see something (unhelpful) like this where the content goes:

<div class=”content”>
print($content)
</div>

Um, OK. So how do you get at the functions which compile the content before it gets to this stage? Well, you probably can, but the easier way is to avoid this step and just access the default $node object which drupal gives you access to with each ‘page’.

To find out what’s hiding inside the $node object, simply do something like this:

print_r($node);

(Yes, I like print_r())

The resulting cacophony in your page source will show you all the node attributes and properties you have access to. Chances are you’ll be able to access these directly to create the customised node template you need.

The ee-yui plugin in the Expression Engine editing interface

The ee-yui plugin in the Expression Engine editing interface

As a follow up to the previous release, I’ve put together another plugin for the Expression Engine content management system.

This one adds the full YUI rich text editor to the ‘body’ area of the Expression Engine publish / edit interface.

The YUI simpleEditor is nice and everything, but sometimes it’s a bit too … simple.

Get the full plugin from the nice folks at Google Code:

ee-YUI full editor > plugin information and downloads

Along with dom traversal (ala CSS2), you can also use CSS2 and CSS3 selectors in jQuery. For example:

lb = $('a[rel="lightbox"]');

will get you all the anchor elements in the dom which have the rel="lightbox" attribute. This, however:

lb = $('a[rel*="light"]');

will get you all the anchor elements in the dom which have the substring “light” in their rel attribute.

Tags: ,

I’ve worked on a project where I used WordPress as a CMS for a (non-blog) content-driven site and was impressed by how flexible it was. I did cheat however and skirted around having to create an entire theme by creating simple PHP pages and pulling the data out using the post ID, as I thought WordPress wouldn’t function as well as a content site when using a theme.

Way wrong. I’m looking forward to using WordPress again, but properly using some of the ifnormation in the following links:

I’ve been using components of the YUI framework for a while now and have been really impressed with the depth and breadth of what it enables you to do. I was pretty convinced I’d stick with YUI for a good while….until today.

Now, I’d heard about jQuery a lot but had never taklen a decent look at it. I decided to after reading Cameron Moll’s latest post in his ‘the highly extensible interface’ series. I had a nice challenge for it too. I needed to recreate our sites navigation using way cleaner mark-up and unobtrusive JavaScript to replace the existing ‘tables-and-document.write’ nightmare.

To cut a long story short, I was able to not only recreate but also improve the navigation and it all took only 2 hours and about 50 lines of code. All I ended up with a solution which was less than a quarter the size of the original but supported more browsers and (in my opinion) had a more satisfying behaviour.

Seriously, a framework which makes things this easy and yet is so powerful deserves a lot of praise. Even after being reasonably familiar with YUI, I believe it wouyld have taken me around three times as long to get a working solution using ther YUI components. Remember – this was the first time I’d ever used jQuery

jQuery, I’m converted.


Archives