Re: [PHP] PHP5, XPath and count()

2004-07-24 Thread Victor Boivie
Christian Stocker wrote: var_dump($xpath-query(count(/catalog/cd)-item(0)); this doesn't work yet in DOM. The returned value has to be a nodeset. Will be fixed some day ;) Thanks, both Jason and Christian I found something else that I think is strange. $dom = new DOMDocument(); $root =

[PHP] PHP5, XPath and count()

2004-07-20 Thread Victor Boivie
Assume an XML file that looks like: catalog cd .. /cd cd .. /cd .. /catalog ... and that I would like to know the number of CDs. An xpath expression would look like count(/catalog/cd), but how do I run this expression? $dom = new DOMDocument(); $dom-load(catalog.xml); $xpath = new

[PHP] Validating forms and showing errors

2002-05-26 Thread Victor Boivie
Hi everybody, This might be a RTFM or STFW-question, but I haven't found it. I want to validate a form (in page1.php) to check if the user has entered a correct email-adress and more, and if he needs to correct some fields, I'd like to display the form again with all correct values filled in

[PHP] Failed to compiled w/ T1lib

2002-04-27 Thread Victor Boivie
To make a long story short: I'm trying to compile PHP 4.2 with Apache, GD, T1lib and more. This is what I'm using: [configuring apache first] ./configure --with-apache=../apache_1.3.24 --enable-ftp --with-mysql=/usr/l ocal/mysql/ --enable-track-vars --enable-inline-optimization --disable-debug

Re: [PHP] RANT: Why doesn't PHP have built-in support for dynamic image generation?

2002-02-03 Thread Victor Boivie
PEAR? I think it would be better if someone did a real PHP module for ImageMagick, just like PerlMagick is for Perl. There is one at http://php.chregu.tv/imagick/, but it's far from complete. If someone would like to help him with the project then it would be great. ImageMagick is so much

Re: [PHP] multiple replaces...

2002-01-12 Thread Victor Boivie
If you only want to replace strings, then drop the regular expression functions! (a common mistake) Use for example str_replace, or in this case, strtr which is better because it accepts an array as replacement pattern. For example: $foo = array(foo = apple, bar = banana); $string = I