Tuesday, June 14, 2011
Mobile Browser Detect
Thursday, July 2, 2009
Easy way to Parse RSS in PHP
Here is some simple code for parsing RSS 2 in PHP. It's so easy, I can't believe it.
<?php
$doc = new DOMDocument();
$doc->load('http://www.softarea51.com/rss/windows/Web_Development/XML_CSS_Utilities.xml');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
}
?>
Thanks to: How to parse RSS feeds with PHP
Thursday, May 28, 2009
PHP Mail on Windows Server
Tuesday, April 28, 2009
CMS Recommendation: ExpressionEngine
Ternary Operator (Short IF Statements) in PHP
// Example usage for: Ternary Operator
$action = ("john" != "frank") ? 'john isnt frank' : 'john is frank';
Wednesday, March 11, 2009
Editing .htaccess with PHP
Thursday, February 12, 2009
Monday, January 26, 2009
Autocomplete textfields
Wednesday, January 14, 2009
IE6 Problem with Form Submit Image Buttons
A lot of times we use images as our submit buttons for forms. I'm sure you've seen it a lot. Well, say you wanted to test if the form was submitted and used the standard way, lets say in PHP, of seeing if the submit button was sent, for example like this:
if (isset($_REQUEST['mysubmitbutton']))
{ ...}
With IE6 this wouldn't work if your submit button was an image. So if you had this as your submit button:
<input name="mysubmitbutton" type="image" value="1" src="someimage.png" alt="" />
Then your script wouldn't work. The reason is that IE6 WILL NOT send over the variable mysubmitbutton.
The workaround is to know that IE6 will send over other information (along with all other browsers). It sends the x and y coordinates of where you clicked on the image. So you'll see mysubmitbutton_x and mysubmitbutton_y. So if you modify your code to look for either of these variables, you'll be good to go!
Credit is to be given to this discussion forum: Differences in form handling btw Mozilla and IE?
Thursday, January 8, 2009
Get referrer with PHP
<?php
session_start();
if(!isset($_SESSION[’referrer’])){
//get the referrer
if ($_SERVER[’HTTP_REFERER’]){
$referrer = $_SERVER[’HTTP_REFERER’];
}else{
$referrer = “unknown”;
}
//save it in a session
$_SESSION[’referrer’] = $referrer; // store session data
}
?>
Tuesday, December 16, 2008
Server Root Path with PHP
Friday, December 5, 2008
Trim Whitespace in PHP
Description
This function returns a string with whitespace stripped from the beginning and end of str . Without the second parameter, trim() will strip these characters:
- " " (ASCII 32 (0x20)), an ordinary space.
- "\t" (ASCII 9 (0x09)), a tab.
- "\n" (ASCII 10 (0x0A)), a new line (line feed).
- "\r" (ASCII 13 (0x0D)), a carriage return.
- "\0" (ASCII 0 (0x00)), the NUL-byte.
- "\x0B" (ASCII 11 (0x0B)), a vertical tab.
Returning Content to PHP Variable with cURL
Thursday, December 4, 2008
PHP Header Redirect
header('Location: http://www.example.com/');
exit;
Thursday, November 20, 2008
Escape Character in MSSQL
Wednesday, November 19, 2008
cURL Alternative to PHP Include (with SESSIONs)
Tuesday, November 18, 2008
cURL Alternative to PHP Include
Monday, October 27, 2008
MySQL DATETIME and PHP
Thursday, September 4, 2008
PHP Cheat Sheet
Friday, August 29, 2008
Displaying Large Text with PHP/ASP from SQL
I found online an explanation for ASP:
I also found something similar related to PHP. My solution in both cases was as stated above, to reduce the limit for the field to something that the server-side languages could deal with. This was the case with both PHP and ASP along with both MySQL and MSSQL.After some testing I found there are no SQL Server 2005 data types
that can be read by an ASP page that hold more than 8000 characters. I
speculate that the 2-byte field length indicator is not read by ASP.
Maybe the field length of the old Access memo data type was encoded
differently. - kirkatsfw-ga