Archive for January, 2008

January 28th 2008

How To Use a MODx Plugin to Cache Snippets

I don’t want to take credit for this, but I definitely wanted to blog about it because I think it is a big deal. In a forum post I made on modxcms.com, ganeshXL came up with an awesome way to cache snippet output with a MODx plugin. Here is what ganeshXL wrote:

  1. create a chunk. Leave it empty. Name it whatever you want, e.g. testMenu

  2. create a plugin. Enter this:

    $myChunk = 'testMenu'; // your chunk name
    $params['startId'] = ‘0′;
    $params['level'] = ‘4′;
    $html = addslashes($modx->runSnippet(’Wayfinder’, $params));
    $sql= “UPDATE ” . $modx->getFullTableName(”site_htmlsnippets”) . ” SET snippet=’$html’ WHERE name=’$myChunk’”;
    $result= $modx->dbQuery($sql);

  3. Check the system event OnDocFormSave + save the plugin.
  4. Change your template: Replace your Wayfinder call with your chunk: {{testMenu}}

Now, every time you edit a doc, the Menu code is being regenerated and stored in your chunk. This should speed up things quite a bit..

This is really cool since it means that you can cache snippet output and give php and mysql a break on processing your code. Like I said, all the credit goes to ganeshXL :) If you’re interested in the context that this was created in, you can read the full post here.

2 Comments »

January 26th 2008

Three Free Browser Compatibility Screenshot Tools

I was in need of doing some browser testing tonight and I thought I’d share the free sites that can be used for checking your web designs across multiple browsers and platforms.

browsershots.org
This is definitely the coolest free browser testing tool. There are lots of browsers and platforms (mostly Unix based) to choose from and the service is fast. If you need to check on alot of browsers at once then this is the place to go. It’s also open source in case you want to start your own browser testing network.

browsrcamp.com
Need to see how your site looks on Safari? You can test it out here.

ipinfo.info/netrenderer/
And this one will show you how your website looks in different versions of IE. It has a cool mixed and difference feature that will overlay IE 6 and IE 7 on top of each other. This one doesn’t make an image of the entire page like the two previous ones do.

That’s all of the free ones that I know about.

4 Comments »

January 15th 2008

New Tool - CSS Formatter and Optimizer

A while back I wrote a post linking to a css formatter and optimizer, not knowing then that it was a piece of open source code. When I figured that out I thought it would be a great idea to put it up on DEVTRENCH. I really love this code since it makes formatting and optimizing css so easy. I’m not sure why they spell optimize with an ’s’ instead of a ‘z’, but it’s probably a British spelling or something (those crazy Brits).

Well you can find the CSS Formatter and Optimiser here

1 Comment »

Next »