Archive | February, 2003

Creating Dynamic Menus with HTML_TreeMenu

Posted on 27 February 2003 by Demian Turner

bugfix 03.03.2002 : ensureVisible element in $nodeOptions array needs to be null

Creating navigation systems is always a major part of putting together a web project. Using a database-driven dynamic menu system is often a good idea, and with the release PHPguru‘s HTML_TreeMenu classes, included in the PEAR library, the prospect is now much more accessible.

The three main steps involved in developing a database-driven menu system are

  1. build the database
  2. choose the appropriate library classes
  3. assemble the required front-end code

This article will cover each of these steps in more detail.

Build the Database
There are various approaches to structuring navigation trees, this article will use the simplest, the so-called parentID structure, recently dubbed the ‘brain-dead’ method by Wolfram Kriesing for it’s astonishing simplicity.

Apologies for non-MSIE users, the code snippets don’t render well in Netscape 6+. You can always view the associated .phps file.

+----+------------+--------+
| id | name       | parent |
+----+------------+--------+
|  1 | Europe     |      0 |
|  2 | N. America |      0 |
|  3 | Asia       |      0 |
|  4 | Spain      |      1 |
|  5 | Madrid     |      4 |
|  6 | Germany    |      1 |
|  7 | Berlin     |      6 |
+----+------------+--------+

 

Comments (8)

Indispensable Tools for Page Layout

Posted on 23 February 2003 by Demian Turner

There are some great free tools over at iconico.com for all you coders moonlighting as page designers.  Of course it’s pretty much impossible to design a web app without getting embroiled in how deep to embed your tables, or overlap your divs, how to keep page weight down, how to keep track of the 35 js functions required on every page ;-).  PHP is only half the battle, and if you let your designer take care of things each page would be a screengrab from photoshop!

Webtool is an indispensable freeware app that, at a  click of a button, allows you to:

  • view the table/div structure of a webpage as a series of highlighted boxes
  • list all js scripts in a page
  • strip the page of all images, or right down to the bare text
  • reset the browser window size to all the default resolution sizes
  • view the document tree

Colorpic is another handy tool that functions in a similar way to tools found in Dreamweaver and Photoshop, with the advantage that it’s a 150kb exe that opens as quickly as notepad.  Colorpic allows you to isolate any pixel on the screen and grab hex/RBG values and save up to 8 of them as chips on a palette.

Comments (1)

Why Did Google Want Blogger?

Posted on 23 February 2003 by Demian Turner

Wired has an interesting article that summarises this week’s big news on the web, Google’s purchase of Blogger, a producer of weblog software with a massive user base.

What does this mean for web-based content coming soon to a screen near you?  Simply that the grass roots effects millions of non-corporate users publishing their own comments and views is now officially newsworthy 😉  I suppose in the future a search on a certain news items might bring back higher results from the weblog crowd than the officials sources: CNN, BBC, etc.  Speaking of BBC, don’t you see a remarkable similarity between their new story format and the weblog (scroll to bottom of story for comments)?

Comments (0)

Browserless PHP Apps: Nova for Windows

Posted on 20 February 2003 by Demian Turner

About a year ago I was combing the web looking for a way to package a PHP-gtk project into a standard Windows installer, you know, double-click on setup.exe and everything takes care of itself.

All the gtk work I’ve seen up till now depends on the user being technical enough to install PHP and the gtk libraries, not good from a market penetration point of view for PHP.  One vital missing link that PHP currently suffers from is the inability to create easilly installable, standalone apps that non-technical computer users can download and fire up.  Like VB apps, or cpu-throttling java applets.

Well now, apparently, all that has changed, with the emergence of Nova, a napster-like fileshareing app written in PHP-gtk by aragorn@gamer.net.nz

Needless to say you do not need PHP installed on your system to run this, and the setup is so easy I think my mother could manage it 😉

Comments (3)

Tags: ,

Bash Freeze, Control+s and Dead Terminals

Posted on 19 February 2003 by Demian Turner

Have you ever been typing away at the command line (this article presumes Bash) and all of a sudden everything freezes?  I don’t mean the usual network failures, modem disconnects and hung servers, I mean just some wrong key you hit while typing.

If you take the time to probe deeper into the mystery, you’ll find this common hangup is down to having hit control+s, probably accidently, which is Bash’s way of doing a scroll lock.  But how do you get out of it?  The terminal seems to be irrecoverable, right?

Comments (0)

Is Function Available in PHP Version x ?

Posted on 17 February 2003 by Demian Turner

What a great list of all the PHP functions and which versions they are available in:

http://www.zugeschaut-und-mitgebaut.de/php/_.html

Comments (0)

HOWTO: logrotate

Posted on 17 February 2003 by Demian Turner

Are you administering a Linux/Unix system that’s running out of space? Getting to grips with the logrotate utility can solve a lot of problems for you. Especially when talking about apache logs, your hard disk can fill up quite quickly if you’re running a few busy sites. Just as an example, a typical 100MB log file when gzipped reduces down to 5MB, so why not use logrotate to take keep your logs under control for you.

Comments (2)

Tags:

Clean Up Your Source Code

Posted on 15 February 2003 by Demian Turner

 

Is your code looking a little sloppy these days?  You just bashed it in to get the idea down quickly, right, why not when you can always go back later and clean it up – yeah right 😉

Well fret not, phpCodeBeautifier to the rescue.  This wonderful, freely downloadable app will clean up your source code for you, available for Windows as an .exe standalone or via the command-line.  There are other command-line PHP CGIs you can run if you’ve chosen not to dirty your hands with Microsoft.

The app allows you to control the formatting with regards to:

  • comment rendering style: PEAR or PHPDoc
  • brace styles
  • aligning equals statements
  • forcing large PHP code tag
  • amongst others …

Comments (1)

Coming up with ‘Secret’ Words

Posted on 15 February 2003 by Demian Turner

While reading through the docs for the Ambivalence PHP framework, I noticed the author had quite an interesting way of coming up with a name for his project.  "Ambivalence" – you think why did he call it that?

Well it turns out it’s the old dictionary-scan-turn-an-acronym-into-a-word trick 😉

Unix-based users are encouraged to give it a try:

grep -i m.*v.*c /usr/share/dict/words

A little regular expression to pull out all words from the dictionary that have the letters MVC contained in them 🙂

Comments (0)

Create Your Own Search Engine with PHP and Google Web Services

Posted on 13 February 2003 by Demian Turner

from http://www.devarticles.com

Want a quick and easy introduction to web services?  Ahm Asaduzzaman’s succinct article walks you through the basics of interfacing with Google’s powerful search services.  Give it a go if you’re not already knee-deep in web services, it certainly opens your mind to the possibilites.

Try a demo here.

Comments (0)

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook