* Aja · My · Ajax *

PHP Notes for Developers

(php tips or examples posted on php.net by Mark Omohundro)



Example #1 xml recursive node
Example #2 curl_exec() routine
Example #3 html file tag
Example #4 html data select
Example #5 php ming sprite/movie stop
Example #6 random decimal number
Example #7 php ming flash dissolve
Example #8 php ming flash shadow
Example #9 php ming flash wipe/fade
Example #10 php ming flash ticker
Example #11 php ming CAPTCHA

Example #1 simple xml recursive node listing routine:

How about a recursive function to reduce the xml hard-coding in your apps?
Here is a listing routine as an example:



[Example #1 link on php.net]

Example #2 simple curl_exec() routine with a twist:

I use the familiar http response status code returned from curl_getinfo()
to put either data, or a custom error message (+ curl_error()) into
a single string. I find this useful when the response ends up in a <div>
or <span> tag.



[Example #2 link on php.net]

Example #3 html file tag listing:

Try this html listing example for all nodes which
includes a few getElementsByTagName options:

/** Change Log **
** $DOCUMENT_ROOT produces a warning message
** in PHP 5.2.8 (Undefined variable: DOCUMENT_ROOT)
** so syntax changed to $_SERVER['DOCUMENT_ROOT']
*/




[Example #3 link on php.net]

Example #4 html data select:

To retrieve selected html data, try these DomXPath examples:

/** Change Log **
** $DOCUMENT_ROOT produces a warning message
** in PHP 5.2.8 (Undefined variable: DOCUMENT_ROOT)
** so syntax changed to $_SERVER['DOCUMENT_ROOT']
*/




[Example #4 link on php.net]

Example #5 php ming sprite/movie stop tip:

To stop ming swf "flash" animation where you want, try these examples:



[Example #5 link on php.net]

Example #6 random decimal number routine:

Try these php routines if you need a random decimal number:



[Example #6 link on php.net]

Example #7 php ming flash dissolve example:

Try this morph routine technique to dissolve a shape:



[Example #7 link on php.net]

Example #8 php ming flash shadow example:

Try this technique to add a shadow to any rectangle:

/** Change Log **
** Note Ming Flash 0.4.2beta compatibility changes...
*/




[Example #8 link on php.net]

Example #9 php ming flash wipe/fade example:

Try this effect with any sprite or movie clip routine:

/** Change Log **
** Note Ming Flash 0.4.2beta compatibility changes...
*/




[Example #9 link on php.net]


Example #10 php ming flash ticker example:

Try this effect to add a ticker/banner/scrolling text display:
(called from another routine that passes text, color values, and text height)



Example #11 php ming CAPTCHA* simulation:

(* CAPTCHA is a trademark of Carnegie Mellon University)

/** Change Log **
** Note Ming Flash 0.4.2beta compatibility changes...
*/




[Example #11 link on php.net]


More examples can be viewed at AjaMyAjax...