 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Zend Developer Zone: NestedSetDbTable class
by Chris Cornutt March 01, 2010 @ 09:14:20
On the Zend Developer Zone today there's a new tutorial looking at a database class/component that implements the Nested Set idea for the Zend Framework - NestedSetDbTable.
There are several ways of realizing demand of storing hierarchical data in database, and most popular methods today are Adjacency List and Nested Set models. [...] With Nested Set model [the] whole tree can be retrieved with a single query, but there are lot of things that need to be done when you need to make some changes in hierarchy. From the title of this article, it's obvious which model is my favorite.
The class helps you to manage nested sets of data pulled from a database and extends the Zend_Db_Table component to pull in all of its additional functionality. You define the "left" and "right" columns in the table and can use constants like NEXT_SIBLING and LAST_CHILD to perform inserts and updates without having to worry about a record's place in the set. Code snippets are included to show you how it all works together.
voice your opinion now!
nestedsetdbtable zendframework class nestedset
Phil Sturgeon's Blog: CodeIgniter Base Classes Keeping it DRY
by Chris Cornutt February 11, 2010 @ 09:46:51
In a new post to his blog Phil Sturgeon looks at creating sharable code for your controllers in a CodeIgniter application (DRY: Don't Repeat Yourself).
The idea is that most of your controllers share something in common with each other. For example: All admin controllers need to make sure a logged in user is present and that they are an administrator. A public controller may want to load a theme for your application and load default user data, navigation links or anything else frontend related.
The problem is solved by creating a base controller - in his example its one called MY_Controller that follows the CodeIgniter naming convention and allows you to easily make other controllers that extend it. You'll also need to make a small addition to your config.php file to get the base controllers working correctly and make them able to be found.
voice your opinion now!
codeigniter base class controller dry
Matthew Turland's Blog: Splitting PHP Class Files
by Chris Cornutt January 25, 2010 @ 13:23:56
Matthew Turland, in trying to solve a problem from work, needed a way to split out some code into two files to simplify and make it easier to use them individually.
The issue I ran into was due to all the generated PHP classes being housed in a single file. I had to process two WSDL files that had several identical user-defined types in common. As a result, I couldn't simply include the two PHP files generated from them because PHP doesn't allow you to define two classes with the same name.
He used the tokenizer extension to create a simple command-line script that did the splitting for him. This script could potentially be used for splitting out other kinds of files too - "unpacking" them from their combined state. You can download the latest version from Matthew's github account.
voice your opinion now!
tutorial split class file wsdl
INSC Dsigns: Building a Shopping Cart using CodeIgniter's Shopping Cart Class
by Chris Cornutt January 18, 2010 @ 08:55:35
On the INSC Designs site today there's a new tutorial walking you through the creation of a shopping cart with the help of the Shopping Cart class that's included in the CodeIgniter PHP framework.
Late last year CodeIgniter v1.7.2 was released with a lot of improvements and bug fixes. This version is now compatible with PHP5.3.0, they added is_php() to Common functions to facilitate PHP version comparisons, modified show_error() to allow sending of HTTP server response codes, and all internal uses now send proper status codes, Form helper improved and a new class which we are about to cover in this tutorial the Shopping Cart Class.
They walk you through some of the basics that the shopping cart class has to offer - adding items, removing them, updating the current item list. They show you how to create each piece of the MVC puzzle - the Product controller, a Cart controller and two basic views, one for the cart and the other for the products. They didn't create a model because they're not hooking it into a database/backend resource.
voice your opinion now!
shoppingcart codeigniter framework class
Vance Lucas' Blog: Get Only Public Class Properties for the Current Class in PHP
by Chris Cornutt January 06, 2010 @ 10:06:29
On his blog today Vance Lucas has posted a method you can use to only get the properties of your class that are in the "public" scope.
PHP provides two built-in functions to retrieve properties of a given class '" get_object_vars and get_class_vars. Both these functions behave the same exact way, one taking an object as a variable and the other taking a string class name. The tricky thing about the two functions is that they behave differently depending on the call scope, returning all of the class variables available within the called scope.
As a bit of a hack (in lower than PHP 5.3) he shows how to use the create_function function to create a small statement in a different scope that returns the only the variables seen from the "outside" - just the public ones. PHP 5.3 users can do it much more cleanly with closures. Code examples for both are included.
voice your opinion now!
public class property createfunction closure tutorial
Konstantin's Blog: The Twitter OAuth PHP Class Gets Even Better
by Chris Cornutt December 17, 2009 @ 12:53:26
In a recent blog post Konstantin take a look at some updates made to a Twitter OAuth library (TwitterOAuth) recently to make it even easier to use:
Just like everybody else, I never read the readme or other documentation files so I dug straight into the class code and examples. Soon after I realized that the new changes were not that bad, so instead of the usual 5 lines of code, I shortened it up to only one. I stopped worrying about parsing XML or JSON, converting them to objects, and I stopped typing in the full address for Twitter API calls. Abraham did all that for us.
It makes it simpler to use, but can break backwards compatibility, so watch out for that if you're using Abraham's library. If you're interested who's using the class, check out this page on his github wiki.
voice your opinion now!
twitter oauth class github
Jeez Tech: Using APIs With PHP? Here Are Your Classes
by Chris Cornutt November 24, 2009 @ 09:57:53
Jeez Tech has a new post with a great (and long) list of PHP scripts to connect your application to any number of popular APIs out there.
Do you want to use an API but you are too lazy to write your own code to handle the requests? If you code in PHP as I do, then you will definitely need these classes. By using the classes listed here you will be able of using a great number of web services with an easy and documented way.
They link to libraries to work with the APIs for Alexa, Babelfish, Bing, eBay, Facebooks, Flickr, Linkedin, MSN, Twitter, Skype and Yahoo. They also mention PEAR and the role it plays in the foundation of many web service connections.
voice your opinion now!
api webservice class
PHPClasses.org Blog: Locating addresses on Google Maps embedded in PHP generated Web forms
by Chris Cornutt November 04, 2009 @ 12:45:51
On the PHPClasses.org blog there's a new tutorial showing how to use the goe-location support the Google Maps API offers to search for and find an address.
Sometimes it is necessary to get the coordinates of a location on the map. The map location plug-in lets the user point to any location by clicking on the map. [...] However, when the user does not know exactly where is the location he is looking for, it may be painful to find it just by zooming and looking around the map. The latest release of this plug-in makes possible for the users to type the address or name of the city you are looking for and search for the location without further effort.
He uses the form creation package to set up a simple address form (address and country) and a call to its connect() method to link Javascript to the form. When submitted, the new features of the class get to work and ask the Google API for the location and a map is generated with a marker on the spot requested.
voice your opinion now!
form googleapi googlemaps address search class
Brandon Savage's Blog: Why Interfaces Rock
by Chris Cornutt September 25, 2009 @ 09:11:32
According to the latest post on his blog Brandon Savage thinks interfaces rock:
When I first learned PHP 5's object oriented syntax and rules, I didn't see much of a point to the interface options. I felt that I could do more by defining abstract classes and at least filling in some of the methods with some details. [...] As a developer, I've often wished there was a way to know that an object - any object - had implemented certain methods. With type hinting and the instanceof operator, it is now possible to determine whether or not an object has those methods, and interfaces make this even easier.
He includes an example or two of how type hinting can help you enforce and predict what sort of methods are defined in other classes. He also points out that this can be one of the major drawbacks of interfaces as well - because they are so strict, they have to be adhered to exactly.
voice your opinion now!
interface abstract class opinon
|
Community Events
Don't see your event here? Let us know!
|