Helping ordinary people create extraordinary websites!
 
Blog Feed

Posts Tagged ‘PHP’




Turn Your Wordpress Blog into a Social Network

in Design, WordPress by JonGos


Wordpress is a CMS that was built for blogging but many people have repurposed it for magazines, newspapers, blog networks and all sorts of other goodies! But did you know you can hack your Wordpress blog to be a no-cost solution for a social network? Well you can, and here’s fifteen plug-ins that will let you do it.

(more…)





8 Cool Functions in the GD2 extension

in PHP by Akash Mehta


Most PHP developers have at least heard of GD2; thanks to its prolific use in CAPTCHA generation, the image functions in PHP are standard practice for many. But the extension’s uses don’t end there. After the fold, here are eight cool things you probably weren’t aware could be done with GD2, and might be useful for your web applications. (more…)





Wordpress Comment Styling Round Up

in PHP, WordPress by JonGos


One question I hear people asking a lot is how to style the comment section in Wordpress. I didn’t have time to go in depth in my tutorial Designing and Coding a Wordpress Theme from Scratch but here are a few links from my del.icio.us to some blogs that break it down in far more detail.


(more…)





The Yahoo! APIs You Wish You'd Heard Of

in PHP by Akash Mehta


It seems the web is always abuzz when another web 2.0 startup releases an API. Everyone starts putting together little mashups; some take off, most don’t. Yet few seem to be familiar with the Yahoo! APIs: with immense power on offer, and with a serialized PHP output option, they’re great for PHP developers. Read on to see just how much power is available, and some cool tricks.

(more…)





Designing and Coding a Wordpress Theme From Scratch (Part 10)

in General, PHP, Photoshop, WordPress by JonGos


Part 3 – “Photoshop to XHTML in 24 Hours”
Part 4 – “Cleaning Up Your XHTML”
Part 5 – “Preloading Images with Javascript and CSS”
Part 6 – “Marking Up is Hard to Do” and “The Anatomy of a Wordpress Theme”
Part 7 – “Beginning with PHP for Wordpress”
Part 8 – “Putting the Press in Wordpress with PHP”
Part 9 – “Marking Up Header.php, Footer.php and Sidebar.php”

So far we’ve made a ton of progress with our theme design. We designed it in Photoshop, we converted to XHTML and then we began the somewhat tedious task of adding PHP. Now that we’ve created index.php, header.php, footer.php and sidebar.php, we can move on to creating the rest of the theme.

(more…)





Learn regular expressions in PHP

in PHP by Akash Mehta


Love them or hate them, regular expressions are here to stay. When it comes to quickly dealing with large blocks of data, batch processing operations or screen scraping, regular expressions are often the most effective solution. There’s just one problem, though – learning them can be as hard as learning a new language altogether. Here’s how to get off to a flying start.

(more…)





Designing and Coding a Wordpress Theme From Scratch (Part 7)

in PHP, Photoshop, WordPress by JonGos


This is the seventh post in series about creating Wordpress themes with your Photoshop designs. You may want to review before we continue….

Part 1 – “Tools For The Task” and “Preparation”
Part 2 – “Layout And Structure” and “Designing Wordpress Themes in Photoshop”
Part 3 – “Photoshop to XHTML in 24 Hours”
Part 4 – “Cleaning Up Your XHTML”
Part 5 – “Preloading Images with Javascript and CSS”
Part 6 – “Marking Up is Hard to Do” and “The Anatomy of a Wordpress Theme”


Beginning with PHP for WordPress

  • First we’ll duplicate index.html and rename the copy index.php. We’re only keeping the original .html file for reference to make sure that the finished PHP operates and looks the same.
  • Let’s open index.php in our text editor. Right now it’s just a .html renamed .php. Our job is to make make it true PHP.
  • (more…)





Designing and Coding a Wordpress Theme From Scratch (Part 6)

in Design, PHP, WordPress by JonGos


This is the sixth post in series about creating Wordpress themes with your Photoshop designs. You may want to review before we continue….

Part 1 – “Tools For The Task” and “Preparation”
Part 2 – “Layout And Structure” and “Designing Wordpress Themes in Photoshop”
Part 3 – “Photoshop to XHTML in 24 Hours”
Part 4 – “Cleaning Up Your XHTML”
Part 5 – “Preloading Images with Javascript and CSS”


Marking Up Is Hard To Do

Wikipedia defines the term markup as a set of annotations to text that describe how it is to be structured, laid out, or formatted. When we say we’re going to ‘mark something up’ it means we’re formatting the document so that it can be read correctly by machines. Hypertext Markup Language (HTML) is the most common form. That can be marked up to Extensible Hyper-text Markup Language (XHTML) and beyond that to PHP to become dynamic.

Now that we’ve got our basic html layout design we can begin the hard work the transition from HTML to PHP.

(more…)





Iterating PHP objects, and readable code too!

in PHP by Akash Mehta


Today I’m going to take a look at object iteration, most commonly found in the Standard PHP Library, and explore using the Iterator interface to simplify looping.

(more…)





PHP array_walk(): Run an array through a function

in PHP by Akash Mehta


If you’ve been developing with PHP for a while, you’ve probably come across this situation in the past:

<?php
foreach ($somearray as &$element) {
    $element = some_function($element);
}

It’s a common sight: taking an array and running (well, walking) its elements through a particular function. Luckily, PHP provides a simple yet powerful function to overcome this: array_walk().

Usage
Using array walk is simple. It takes two arguments, an array of data and a callback function to pass the array to. It examines the array and calls the callback function with each element of the array, allowing you to run the entire array through the function without extracting the array yourself. Consider this:

<?php
function some_function(&$element, $key) {
    return $element + 1;
}

// This:
foreach ($somearray as $key=>&$element) $element = some_function($element, $key);

// becomes this:
array_walk($somearray, "some_function");

It’s cleaner, faster and more effective. It also gives your callback function more information than you might usually provide. The callback parameter can be any : “function_name”, array(‘Class_name’, ‘method_name’) or even array($object, ‘method_name’) (where $object can be $this as needed).

Syntax
The syntax is very simple:

array_walk (array &$array, callback $callback[, mixed $userdata]);

The first parameter is the array that you want to run through the function. The second is the callback – for a function, class method or object method. The third allows you to pass a third parameter to the callback function from within the current context. This can be anything at all, and along with the array element and its key/index, will be passed directly to the function without modification.

For more details, see array_walk() in the PHP manual.







GET OUR NEWSLETTERS