News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

Tiffany Brown's Blog:
Simple pagination for arrays with PHP 5
December 15, 2008 @ 08:48:20

Tiffany Brown has a quick tutorial on a pagination method she's come up with for splitting out array contents over multiple pages.

While working on a recent project, I had to build a feature that displayed a list of files available in a directory. A simple way is just to use scandir() and a foreach loop to spit out a pretty list. There's a small problem though: long lists aren't all that user friendly. I decided instead to paginate the results. Here's one way to do it using PHP 5.

Her method reads in all of the (valid) files from the directory, assigns them to an array and uses the array_chunk function to split them up into groups on five. These groups can be easily looped through and displayed out as links easily.

0 comments voice your opinion now!
pagination php5 arraychunk directory files



PHPro.org:
SPL Autoload
November 14, 2008 @ 09:31:48

On the PHPro.org website, Kevin Waterson has written up an introduction to the handy autoloading functionality that comes with PHP5 releases - the __autoload method from the Standard PHP Library (SPL).

The SPL __autoload() method is one of the Magic Methods supplied in PHP. The __autoload method is called whenever a class is instantiated and will load the classs the the first time it is called. No longer is include(), require, include_once() or require_once needed as the SPL autoload takes care of this interally.

He looks at how you can use it to load a directory of classes, how to use multiple autoloads in a single script and how to use it with interfaces to register a loader and include it as needed.

0 comments voice your opinion now!
spl autoload standardphplibrary tutorial introduction directory register multiple


NETTUTS.com:
Scanning Folders with PHP
November 13, 2008 @ 14:18:28

The NETTUTS.com site has posted a new PHP-related screencast that covers a simple script to scan over the contents of folders in PHP. To illustrate, they create an image gallery script that mirrors the filesystem structure.

Let's imagine that you want to build a page that will display snapshots of your latest work. [...] In such instances, the best solution is to make PHP scan your "portfolio" folder and dynamically create the code for you. If you want to update your page with a new snapshot, all that you need to do is drag the image, and its respective thumbnail, into the appropriate folders - and PHP will do the rest. Let's build it now!

The screencast comes complete with the entire source and a link to a demo to show the end result.

0 comments voice your opinion now!
scan folder filesystem directory tutorial photo gallery screencast


PHPImpact Blog:
Scalable and Flexible Directory Structure for Web Applications
August 11, 2008 @ 11:17:30

In this new post on the PHP::Impact blog, Federico looks at some examples of directory setups for web apps that can help to make them both scalable and flexible.

Designing a modular and component-based directory structure for your Web applications can seem like an easy task. If your system is small, it may seem logical to go with the simplest design possible, but if there's anything more time consuming and complex than developing a new directory structure design, it's trying to redesign an existing system that wasn't developed with growth in mind.

He breaks it up into a few different topics that can be applied where needed to keep the application in check:

  • Consistency
  • Scalability and Flexibility
  • Single Application
  • Multi-application
  • Naming Conventions
  • Versioning
  • Proposed Structure
0 comments voice your opinion now!
scalable application flexible directory structure


PHPedia Blog:
Top 5 PHP replacements for Apache default directory listing
July 24, 2008 @ 10:21:25

The PHPedia blog has posted their top five list if scripts to replace the default listing Apache does for a directory without an index file.

Here's their list:

Check out the PHPedia post for example screenshots of each.

0 comments voice your opinion now!
directory listing apache topfive default software


Builder.com.au:
How do I...recursively scan directories with PHP's DirectoryIterators?
June 18, 2008 @ 07:55:21

Builder.com.au has a new tutorial posted today talking about the use if Iterators (from PHP's SPL) to recurse down through directories on your local drive.

One of PHP5's most interesting new features is the addition of Iterators, a collection of ready-made interfaces designed to help in navigating and processing hierarchical data structures. These Iterators significantly reduce the amount of code required to process an XML document tree or a file collection.

They give three examples - two basic ones showing a simple use of the DirectoryIterator and RecursiveDirectoryIterator and another slightly more complex one showing how to get information from the recursive iteration as it goes down.

0 comments voice your opinion now!
directoryiterator iterator recursive directory example code


Sebastian Bergmann's Blog:
Test Runner Improvement in PHPUnit 3.3
April 11, 2008 @ 09:46:29

Sebastian Bergmann has posted some details about an update that's been made to the test runner for the PHPUnit (3.3) unit testing suite - an allowance for directories instead of just files on the command line.

Given a directory, the test runner will recursively scan the directory for *Test.php files, build a test suite out of the *Test classes, and run it.

PHPUnit is framework that makes writing tests for your code easy and also includes functionality to run the tests and analyze their results.

0 comments voice your opinion now!
test runner improvement phpunit commandline directory file


Lars Strojny's Blog:
New magic constant in PHP 5.3
February 22, 2008 @ 15:02:00

In this new blog post today, Lars Strojny talks about a new magic constant that will be joining its brothers in the upcoming PHP 5.3 release - __DIR__.

In PHP 5.3 there will be another magic constant __DIR__. [...] To allow this, the internal function php_dirname() has been moved in the Zend Engine and is now called zend_dirname(). Nevertheless an alias still exists.

__DIR__ will join the other constants (like __LINE__ and __FUNCTION__) to help give the currently running script a little introspection for things like its filename, what class it's currently in and now, what directory the file currently lives in.

0 comments voice your opinion now!
dir magic constant directory php5 new


Evert Pot's Blog:
PHP WebDAV Integration Library
December 13, 2007 @ 11:17:00

Evert Pot has posted about a library he's creating to integrate WebDAV support with PHP and make things simpler for those needing to access the shares.

I intend to make this library as easy as possible to use, without making it a black-box-like system. Focus will not be on everything WebDAV could possibly provide, but instead on the features that are actually supported by the operating systems.

His goal is to make it as simple as making a 'File' and 'Directory' class to interface with the remote system and has two things he's deliberating on as far as features to include in the library - support for the custom properties WebDAV allows and the ability to lock files and directories.

If you'd like to check out the current progress of the library, check out its page on the Google Code site (as well as this discussion group he's set up).

2 comments voice your opinion now!
webdav library interface file directory property lock webdav library interface file directory property lock


Richard Heyes' Blog:
mail() replacement
December 10, 2007 @ 07:57:00

Richard Heyes has posted about a mail() replacement he's come up with that adds the additional functionality of backing up all of the data to a certain directory of your choosing.

A simple drop in replacement function for PHPs mail() function called mailb() which backs up all the data to a specified directory. [...] I've also added a simple header file to Apache and the download directory so it looks nicer.

You can download a copy of his library here as a .phps file (a quick and easy 40ish line script).

0 comments voice your opinion now!
mail email replace mailb backup data directory mail email replace mailb backup data directory



Community Events









Don't see your event here?
Let us know!


package releases ajax cakephp zendframework mysql job database PEAR code book release security framework conference example application developer zend PHP5

All content copyright, 2009 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework