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

SitePoint PHP Blog:
PHP Streaming and Output Buffering Explained
September 04, 2014 @ 10:17:44

The SitePoint PHP blog has a new performance-related post to the site today from Imran Latif. This new post looks at effective use of output buffering and streaming and explains how it works and some examples of its use.

As a PHP developer, I was wondering whether we can have something similar [to Streaming in Rails] in our favorite language? The answer is yes - we can easily have streaming in PHP applications with little effort, but in order to get this right we have to become familiar with some underlying concepts. In this article, we will see what streaming is, what output_buffering is and how to get our desired result under different webservers (Apache, Nginx) and PHP configurations (CGI, mod_php, FastCGI).

He starts off with a comparison of the two different methods, streaming and output buffering, and how they behave in the output of content. He then gets into some simple examples with PHP with various methods: a simple delay, chunking up output and finally using the actual output buffering handling PHP offers. He also includes an example of streaming content over an Ajax request with a simple test using the sleep function.

0 comments voice your opinion now!
streaming output buffering tutorial introduction beginner ajax

Link: http://www.sitepoint.com/php-streaming-output-buffering-explained/

NetTuts.com:
More Tips for Best Practices in WordPress Development
July 25, 2014 @ 09:18:09

NetTuts.com has published a few more WordPress tips and best practices to help you get the most out of your WordPress-based application.

Welcome to the second part of the series. In the first article, we explained the WordPress Coding Standards, how to avoid namespaces collisions, comments in the code, and some basic security tips. Today, we are going to go a bit deeper and write some more code and learn some techniques to improve performance and security of our plugins.

They look specifically at when you should include your scripts and styles, formatting Ajax calls and working with filters and actions. Code snippets are included with each point with links to some other resources for some of the topics to provide more information.

0 comments voice your opinion now!
wordpress bestpractices development ajax scripts styles filters actions

Link: http://code.tutsplus.com/articles/more-tips-for-best-practices-in-wordpress-development--cms-21013

David Müller:
Cross Domain AJAX Guide
December 10, 2012 @ 12:17:39

In his latest post David Müller covers some of the things to consider when working with cross-domain ajax requests including CORS and iframes.

As it is widely known, AJAX Requests are only possible if port, protocol and domain of sender and receiver are equal. [...] Having this cleared out, we will cover ways around this restriction.

He covers three main approaches to allowing these cross-domain requests (and some of the security implications that can come with them):

  • CORS (Cross Origin Resource Sharing)
  • JSONP (Javascript with a local domain callback)
  • Iframes

He also briefly mentions things like window.postMessage (HTML5) and the use of a backend script to proxy a request into your application's local code.

0 comments voice your opinion now!
crossdomain ajax cors iframe jsonp tutorial introduction


DZone.com:
PHP Ajax Cookbook (Book Review)
April 17, 2012 @ 13:03:50

On Dzone.com there's a book review from Ivan Ilijasic covering a recently released title from Packt Publishing, the "PHP Ajax Cookbook" (by Milan Sedliak, Rajesh Jeba R. Anbiah and Roshan Bhattarai). His review gives a "one minute bottom line" about the book and its contents.

I've been in PHP development for more than 10 years and this book is really useful material. I could recommend it to beginners and experienced developers. From my point of view, there are three types of developer books - complete byte-to-byte fat books, introduction books and cookbooks. I want my cookbook to have useful and simple to use recipes. This book fulfilled my expectations.

He mentions some of the topics that the book covers including javascript libraries and frameworks (mostly jQuery) and recipes for things like form validation, dynamic content, pagination and drag and drop functionality. He also points out some coverage of testing and debugging content as well as web service "mashups" and mobile app development.

0 comments voice your opinion now!
book review ajax cookbook packt


NetTuts.com:
Build Ajax Data Grids with CodeIgniter and jQuery
September 23, 2011 @ 12:23:59

In a new tutorial from NetTuts.com today they show you how to combine a CodeIgniter-based backend and a jQuery frontend to make a simple Ajax data grid of data pulled from a database.

In this lesson, we will create a CodeIgniter library that allows us to generate data grids automatically for managing any database table. I'll explain each step required to create this class; so you'll likely learn some new OOP techniques/concepts in the process! As a bonus, we'll proceed to write some jQuery code that will enable a user to update the data grid's content without having to wait for a page refresh.

The tutorial's broken up into a few different steps, each complete with descriptions and plenty of code ready for cut-and-paste:

  • Build a Data Grid Generator Class (a helper in PHP)
  • Testing the Datagrid Helper Class with a CodeIgniter Controller
  • Implementing Ajax (jQuery to the Rescue!)
  • Check All or Nothing!

You can also download the source for all of the scripts if you'd like to dive right into the code.

0 comments voice your opinion now!
data grid ajax jquery codeigniter framework tutorial


NetTuts.com:
How to Upload Files with CodeIgniter and AJAX
September 12, 2011 @ 12:03:27

New from NetTuts.com today there's a tutorial for those using the CodeIgniter framework for their application. It shows how to upload files with Ajax and a simple form (with jQuery and AjaxFileUpload).

Uploading files asnychronously can be a pain at the best of times, but when coupled with CodeIgniter, it can be a particularly frustrating experience. I finally found a way that not only works consistently, but keeps to the MVC pattern.

They help you create a database table to store the file information in (filename and title), make the controller to handle the request and build the view (with the form). Also included is the javascript you'll need to get the AjaxFileUpload script working for your file upload field. They extend the controller to handle the file upload and make a model to handle the upload and fetching of file information. The tutorial is finished off with a simple "delete" action to remove any file that's been uploaded.

0 comments voice your opinion now!
tutorial ajax upload codeigniter framework


Tutorialzine.com:
AJAX-enabled Sticky Notes With PHP & jQuery
August 31, 2011 @ 10:16:35

On the Tutorialzine.com site there's an interesting (though a bit older) tutorial showing you how to combine jQuery, PHP and some CSS+HTML to make a simple sticky note application complete with multiple note support and drag-and-drop abilities.

Today we are making an AJAX-enabled Sticky Note management system. It will give visitors the ability to create notes with a live preview, and move them around on the screen. Every movement is going to be sent to the back-end via AJAX and saved in the database.

They use the fancybox plugin for jQuery to make creating the notes a lot simpler. Included in the tutorial is all of the HTML, CSS, javascript and PHP you'll need to create the application (as well as plenty of description along the way). You can see a demo of it in action here or just download the source and dive right in.

0 comments voice your opinion now!
tutorial ajax sticky note jquery fancybox plugin


Joris de Wit's Blog:
Extending different layouts for Ajax requests in Twig, Symfony2
August 29, 2011 @ 11:39:34

Joris de Wit has a (very) quick post about a handy tip he found about switching layouts easily with Twig in his Symfony2-based application - a handy ternary sort of switch that can detect when something's an Ajax request.

I just learned about the 'app' global variable in twig. It's very handy for loading a special layout for ajax requests.

The "app" variable allows you get get back at some of the settings of your application and check on special things like the isXMLHttpRequest in his example. For more information about Twig and how you can add it to your application, check out Twig-Project.org. Using it's as simple as adding a phar.

0 comments voice your opinion now!
twig symfony2 layout switch template ajax request


David Stockton's Blog:
Changing ErrorController to work with AJAX
August 12, 2011 @ 08:58:06

David Stockton has a new tutorial posted to his blog - a technique he's found useful in his Zend Framework application to make the ErrorController work with Ajax calls to reduce the message you get back to just a JSON response.

If you've ever built a Zend Framework MVC app which makes AJAX calls, you may have noticed that if an error occurs, you'll get a chunk of JSON followed by the HTML for the error page. If you've built a layout, you'll get all of that back to. This is fine if your users hit the page in the browser but it can cause problems with your JavaScript being able to correctly decode your JSON.

The fix is pretty simple, though, and only requires that you add the error handling action to the Ajax context to force it to drop the layout and any other HTML that might come along with the view. He includes a bit more code to have the error handler include the exceptions and pass them out to be included in the JSON response.

0 comments voice your opinion now!
zendframework error handler controller ajax response exception


Gonzalo Ayuso's Blog:
Populating datagrid techniques with PHP
July 19, 2011 @ 09:25:46

In a new post to his blog Gonzalo Ayuso looks at the code required to populate a jQuery data grid with the records as pulled from a (MySQL) database.

Today I want to speak about populating datagrid techniques with PHP. At least in my daily work datagrids and tabular data are very common, because of that I want to show two different techniques when populating datagrids with data from our database. Maybe it's obvious, but I want to show the differences.

He uses "old school spaghetti code" rather than a framework to keep things simple and pulls the data from the database with a PDO connection. This information is then manually pushed into an HTML table and the data grid functionality is applied to it. The other method involves a little bit of JSON magic that the data grid library pulls in and populates for you, still appending rows to a table.

He notes that the second method seems faster to the user since the page and table are rendered first, but it also comes at the cost of more than one HTTP request.

0 comments voice your opinion now!
datagrid jquery technique preload ajax json



Community Events





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


community opinion symfony laravel podcast install list deployment series update library interview package language zendserver release api introduction tips framework

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