php
PHP: Session Variables
Wednesday, 22 October 2008 | Jason SlaterSession variables used to need registering however now they are more in line with _POST variables, so:
On the page to activate Session Handling use
session_start();
You can always check the Session is working by obtaining the Session ID using
PHP: Process Technorati API
Friday, 3 October 2008 | Jason SlaterProcessing the Technorati API allows you to receive information about your blog and rankings logged with the Technorati service. An example of extracting various pieces of information is here
$url = “www.yourchosendomain.com”; $apikey = “putyourapikeyhere”; $service = “http://api.technorati.com/bloginfo?key=” . $apikey … Read More
PHP: XML element information
Friday, 3 October 2008 | Jason SlaterObtaining information regarding elements in XML is relatively straight forward
// xml input file $xmldoc = “sitemap.xml”; // test to open file if ( !$dom = domxml_open_file($xmldoc) ) { echo “The file cannot be loaded.”; } else { // show … Read More
PHP: Highlight a keyword in a phrase
Thursday, 14 August 2008 | Jason SlaterPHP Routine to highlight a keyword in any given phrase:
function highlight( $phrase , $keyword) { $parts = explode( strtolower($needle), strtolower($phrase) ); $pos = 0; foreach( $parts as $key=>$part ) { $parts[ $key ] = substr($phrase, $pos, strlen($part)); $pos … Read More
PHP: Select the latest image or file in a folder
Wednesday, 23 July 2008 | Jason SlaterIt can be useful to set a placeholder in a web page, such as an image, and for this place holder to be set to be the latest file in a given folder; or to select a random image/file from … Read More