Posts Tagged Programming

Include latest article list on non WordPress website

Recently, we needed to develop a website that used a blogging system – but didn’t¬†necessarily¬†want to use the blog to power the full website as we had other plans for that.

In a nutshell all we really needed was to be able to include a top 10 latest articles list from our WordPress blog on the home and left handside of every page.

In the past, we probably would have used a RSS feed parser to include the latest list, but this was never very clean for us. After much searching on the web we eventually came up with a combined solution and here it is forever embedded on my blog so we don’t have to search the next time round:

<?php
      require('pathto/blog/wp-blog-header.php'); // change this to fit your path
      query_posts('showposts=10');
?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

<?php endwhile; ?>

Tags: , , , , , ,

No Comments

Typo3 : Typo3temp folder full of js files


A common problem with anyone using Typo3 4.2 and GMENU Layers is that Typo3 creates a temporary js file each time a page is loaded. This ends up leading to your typo3temp folder being filled with thousands of js files. In some cases, with busy websites, we’ve seen the Typo3temp folder filled with as much as 1-2GBs of temporary js files. Clearly a problem, but not such as easy one to fix.

If you, for some reason are still running the 4.2 version of Typo3 here’s how you fix the issue.

The first thing you need to do is delete all those temporary js files from the typo3temp folder. This might be a bit of a nightmare if there are hundreds and thousands of files. In one case I needed to resort to removing the files via ssh using a wildcard and file name from within the typo3temp folder, e.g. rm -f javascript_12* (be very careful using the rm cmd MAKE SURE YOU ARE IN THE TYPO3TEMP FOLDER – no warranty provided by me if you mess up!).

Once that’s done and you’ve taken a complete backup of your website, complete the following steps:

1. Download patch file from http://bugs.typo3.org/view.php?id=12376
2. Upload the patch file to the root of your Typo3 installation (e.g. the directory with index.php and Typo3 folder etc)
3. Log into your SSH account and cd to the root folder
4. Type patch -p0 -i nameofpatchfile.diff
5. Log into FTP and delete all temporary js files from the typo3temp folder

You should now log on to your website and click around a few pages. Then check your Typo3Temp folder again through FTP to see if any js files have been created. You should really only see one (unless you have multiple navigations).

That’s it!

Tags: , , , , , , ,

No Comments

Simple image gallery & slideshow with Scriptaculous and Prototype

We’re currently working on a project using quite a lot of AJAX, which is great fun. We decided to go with the prototype and scriptaculous javascript framework for a number of reasons, but that did bring some difficulties.

One of the requirements of the project was a simple image gallery to show a number of images related to a particular record from the database. Obviously, since the site was predominantly AJAX’ed, we wanted a nice image gallery that would pup up on a mouseover from a dynamic URL that was called using AJAX.

However there were no simple “already built” javascript image galleries out there that use scriptaculous & prototype. Most of the more basic ones were developed on the MooTools framework and this caused a conflict with our other code.

So I set out to create a simple image gallery that we could use for the site.

I’m sure other people have had this problem, so I thought it would be a good idea to give it out to you all to play with yourself.

This isn’t the final version to be used as it’s been a while since I coded and I’m sure I haven’t done a very good job. But it works none the less and you can of course clean it yourself if you need to!

in terms of design I’ve also left it quite messy so that you can style it yourself. It’s very easy to template.

I don’t think I’ll bother boring you with the details of the script, I personally never read them and just download the code. Here’s the script to download – have fun!

Oh and here’s a demo example of it in action!

UPDATE:
Dave from ISOTOPE Communications has improved the script – you can get his version here:
http://www.icommunicate.co.uk/articles/all/simple_slide_show_for_prototype_scriptaculous_38/

Tags: , , , , ,

24 Comments