News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPBuilder.com:
Six Cool PHP Tricks You May Not Know
April 23, 2010 @ 08:44:24

On PHPBuilder.com there's a new article with a few things - six things, to be exact - that you might not know about the PHP language as written up by Chris Roane.

Over the years I've come across some useful tricks in PHP that are not obvious, but are worth mentioning. This is not meant to be a comprehensive list of all the useful tricks that you can do with PHP.

The list of six includes:

  • Count Characters in a String
  • Use Single Quotes When Possible
  • Use Arrays in Form Fields
  • PHP Output Buffering
0 comments voice your opinion now!
trick quote array output buffering


DevShed:
Using Timers to Benchmark PHP Applications
April 30, 2008 @ 14:31:08

DevShed has posted the second article in their series looking at benchmarking your PHP scripts. This time they look at the use of "timers" to check on script execution length.

Since you already know how to create timer functions and classes, in this tutorial, I'll create some concrete examples that show where these timing mechanisms can be applied in order to evaluate the performance of certain PHP applications.

They create a few classes that connect to a database and pull out rows (handing it off to a Result class). They use these classes in two examples - one with compression (output buffering) and one without using their Timer class to evaluate the differences.

0 comments voice your opinion now!
timer benchmark application tutorial class mysql row output buffering


Arnold Daniels' Blog:
How I PHP The Output Handler
November 16, 2007 @ 11:17:00

Arnold Daniels has a quick little tutorial posted to his blog about using the output handler in PHP (one of what he considers a technique that's "missing out" from normal PHP use). His example involves buffering the common page parts - like a template.

A website usually has a part which is common across all pages, containing the HTML header, the menu and those kinds of things. This is often solved in one of four ways. [...] All of these methods work, however there is a better way to solve this. You guessed it, by using an output handler.

He links to an example he's created and includes the code for his OutputHandler class to make controlling the content easier.

0 comments voice your opinion now!
output buffering handler tutorial template output buffering handler tutorial template


LoopPo Blog:
PDML PHP tricks
March 01, 2007 @ 10:48:00

A new post on the LooPo blog points out a handy PHP library to make and work with PDF files in PHP - Portable Document Markup Language (PDML).

I was curious how this works, as it seemed pretty different from previous similar libraries (PDFLib, FPDF), that offered a programmatic API to generate PDF DOMs instead of a markup language.

They describe how it works, what's included with the download and how it uses output buffering to get the job done as well as a few updates and further tips on its usage.

2 comments voice your opinion now!
pdml tricks portable document markup language pdf output buffering pdml tricks portable document markup language pdf output buffering


Riff Blog:
Console encoding in PHP-GTK apps
November 20, 2006 @ 10:58:00

PHP-GTKers working in English-related applications, don't have a problem with debugging messages output to a console when debugging, but applications on a more international front have issues with their output. But help has been found in this new post on the Riff Blog - a method for correctly encoding PHP-GTK applications.

PHP scripts are typically stored under UTF-8 encoding to limit i18n headaches, while the console in which their output will be displayed is normally configured to some regional encoding, like IBM850 in Windows/XP French.

So we need a workaround...

He splits the process out into a few steps, each with its own explanation and code:

  • Builtin tools
  • Buffering
  • Flushing
  • PHP-GTK is not PHP for the Web
  • Auto-flushing
All wrapped up with a final solution - using the iconv functionality in combination with some output buffering to correctly display the message.

0 comments voice your opinion now!
phpgtk encoding output console i18n buffering iconv phpgtk encoding output console i18n buffering iconv


ThinkingPHP:
Issues with output buffering in CakePHP
July 17, 2006 @ 06:13:16

If you're using the CakePHP framework and are having a problem with output buffering, this quick tip on the ThinkingPHP blog might work for you.

Output buffering is a useful way to accomblish things in php like gzipping all html output and such. A while ago I wrote about it on this blog (see "A miracle called gzip") as well.

The reason I write about it again is, that I have discovered a little issue with it in CakePHP.

He notes that if you just use the ob_start with the gzip handler, debug issues arise. The soultion he's come up with, though, isn't quite as simple, but gets the job done in about ten lines and is easy to drop in anywhere.

2 comments voice your opinion now!
cakephp framework output buffering gzip debug cakephp framework output buffering gzip debug


PHPit.net:
Having fun with PHP's output buffer
April 17, 2006 @ 07:13:24

One of the more powerful and handy features that PHP offers is output buffering. It allows you more control over when the client's browser gets the information instead of just spewing information at random. It is a little tricky to get the hang of, so PHPit.net has put together this new tutorial on how to get started.

I'm sure most of us have come across the dreaded "Cannot modify header information - headers already sent", and this is usually caused when your script tries to send a header or set a cookie, when it's already sent output. The easiest fix is to make sure no output has been sent, but it's also possible to enable something called output buffering which also solves the problem.

In this article I'll first show you how output buffering works, and take you through most of its basic functions. After that we'll have a look at what's possible with output buffering, and show you some neat tricks.

The groundwork is laid first, giving a simple "Hello world" example to show how the code flows. They show how the buffering system works and how to use a callback function to modify the contents of the buffer before outputting (including a full replace function to text within the buffer from an array). They follow that with a look at creating your own HTML tags and using the gzip compression functionality to speed up your pages.

0 comments voice your opinion now!
output buffering example tutorial simple callback replace gzip output buffering example tutorial simple callback replace gzip


Justin Silverton's Blog:
10 PHP speed improvement tips for apache
April 13, 2006 @ 06:47:33

Justin Silverton shares withus today ten easy tips for speeding up your PHP applications with Apache.

The suggestions include things like:

  • Enabling compression of HTML with the output_handler settings in your php.ini
  • Move from file-based sessions to shared memory sessions
  • Use output buffering
  • Don't use images when text will do

Some of the suggestions are just general web development items (such as that last one), but some web developers out there need to be reminded of them. There are still too many image only sites out there...

0 comments voice your opinion now!
ten speed tips apache output buffering sessions general ten speed tips apache output buffering sessions general


DevShed:
Using HTTP Compression in PHP - Make Your Web Pages Load Faster
April 10, 2006 @ 15:26:56

One of the holy grails of web development is to have your pages lost the fastest way possible. People spend hours optimizing images and condensing the amount of data they actually send over the wire to reach this goal. There are, however, other ways to achieve some of the same results, HTTP compression being one of them. For those that aren't familiar with the topic, DevShed has this new article to bright you up to speed.

This article, the first of three parts, shows you how to make PHP pages load faster by showing you how to compress dynamic PHP pages. Techniques covered include using PHP's built-in "gzencode()" function, along with output buffering control functions.

Since PHP offers a powerful built-in library for handling HTTP compressed data, over this series I'll explain the basics of working with HTTP-compressed PHP pages. I'll illustrate, with several code samples, different methods for compressing dynamic PHP pages.

They start with the basics, writing up a simple script to compress the output from a simple PHP file, one that displays records from a "users" database. With that foundation laid, they move on to the heavy stuff - using more than just simple output buffering to speed up those pages. Their new example makes use of the gzip functions in PHP to compress the data even further. A gzip header is passed off to the browser and it pulls it all neatly compressed over to open on the client-side.

2 comments voice your opinion now!
compression http pages load faster gzip output buffering compression http pages load faster gzip output buffering


O'Reilly:
Autofilled PHP Forms
March 17, 2006 @ 07:32:18

The O'Reilly OnLamp.com site has a tutorial posted that takes a look at a simple way to "auto-fill" HTML forms with a little help from PHP.

I hate typing, but I like writing code. A while ago I started to dread all the rote typing required to handle forms in PHP, and began looking for a Better Way. This article describes how I used PHP's regular expression functions to do most of the heavy lifting required to process forms properly, saving lots of typing and giving me time to do stuff I don't hate, such as writing code (and playing NetHack).

He sets it upJeff Cogswell, have had) to display the form, validate the input, and display the results of this validation (or a success message).

He takes a little bit different kind of method behind it than several form packages out there - he grabs the HTML output of the form with output buffering and does replaces on that with the previously entered values.

0 comments voice your opinion now!
autofilled forms html output buffering string replace regular expression autofilled forms html output buffering string replace regular expression



Community Events





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


framework unittest language refactor install laravel testing code api community podcast opinion developer threedevsandamaybe list introduction symfony2 interview release series

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