Formatting a multi-level menu using only one query

By crisp on Sunday 23 December 2007 23:46 - Comments (22)
Category: PHP, Views: 55.582

In the programming forum (dutch) on Gathering of Tweakers I often see people struggeling with multi-level menu's stored in a database and the formatting of such menu in HTML.

This is actually quite a common programming problem that can be solved using some kind of recursion or stack-based processing in order to create a tree out of a flat datastructure containing parent-child relations. However, in most cases the final solution that is presented involves seperate queries being executed inside a loop or inside a function that is called recursively which retrieves the child-elements for a specific parent. In situations where the menu has many items and/or has many levels this could easily result in dozens of queries being executed only to generate something simple as a treelike-output.

I would like to show you how this can be done using only a single query.

Read more »

Banners en browsing performance impact nl

Door crisp op maandag 17 december 2007 00:06 - Reacties (13)
Categorieën: Internet,, Views: 12.310

Het zal niemand verbazen dat reclame op websites (banners) een negatieve impact hebben op de 'browsing performance': je moet immers meer data ophalen en dat moet ook nog eens allemaal gerendered en getoond worden door je browser.

Lees verder »