Lil Josh

A tech blog about web development with PHP, MySQL, jQuery, CSS3 and various other programming languages. You will not find anything about ColdFusion, ASP.NET, C# on this blog.

Searching entire Dreamweaver site for files by content

September 8, 2014

I often want to search my entire site for files that contain a specific word, phrase or string. The best way to do this, that I found, was to GET the entire Dreamweaver site to your computer so now you have all the files locally. Then you can use Dreamweaver search (CTRL + F) to search the entire local site for content. Hope this helps and if not here are some additional sources:

content dreamweaver entire site search

jQuery JSONP Cross-domain AJAX Callback Function

August 29, 2014

There may be times where you need to make an AJAX call to a resource from another domain, but browsers will not allow a simple AJAX GET. Instead you’ll need to implement a callback function and use JSONP. Here’s an example of the requesting AJAX script:

var username = 'liljosh';
var url = '//'+username+'&output=json&callback=?';
$.getJSON(url, function (data) {

and the callbackScript.php could look like this:

output("Username is $_GET[username]");
// output as JSON
function output($html) {
if(isset($_GET['callback'])) $html = $_GET['callback'] . '(' . json_encode($html) . ')';
AJAX Callback Function Cross-domain jquery JSONP

Texting with PHP

June 6, 2014

Ever needed to text someone through PHP? It’s very simple! Most cellular providers give an email address with your phone number that can be used to text that number. This is known as “email to SMS gateway”. For example if my number is (555) 555-5555 and I used AT&T then emailing would send a text to my phone. So you can probably guess how the PHP looks, but here’s an example:

$from = "Lil Josh <>"; // sender
$subject = "Subject appears in the text message";
$message = "This is the contents of the text";
// send text message
mail("",$subject,$message,"From: $from\n"); // Verizon
mail("",$subject,$message,"From: $from\n"); // AT&T
mail("",$subject,$message,"From: $from\n"); // T-Mobile
mail("",$subject,$message,"From: $from\n"); // Virgin Mobile
mail("",$subject,$message,"From: $from\n"); // Sprint
mail("",$subject,$message,"From: $from\n"); // Nextel

For a more complete list of providers visit

AT&T Nextel PHP Sprint T-Mobile texting Verizon Virgin Mobile

Recursion in PHP

May 29, 2014

Using recursion can be a little hard to grasp if you are new to the concept. In it’s simplest form it’s a function that calls upon itself to create a loop. It is commonly used for traversing tree structures. This example shows PHP using recursion to get a list of all the child pages under a folder structure.

function getPages($folder, $pages=array()) {
//function returns everything in the folder 1 level
$assets = getChildren($folder); 
foreach($assets as $asset) {
if($asset->type == 'folder') {
$pages = getPages($asset->path, $pages);
} else if ($asset->type == 'page') {
array_push($pages, $asset->name);
return $pages;


example function PHP recursion