2017 © Pedro Peláez
 

library buffermanager

Manager of PHP output buffers

image

tjm/buffermanager

Manager of PHP output buffers

  • Wednesday, December 3, 2014
  • by tobymackenzie
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHP Buffer Manager

A simple manager for PHP output buffers. Can manage named or unnamed buffers., (*1)

Useage

The most common useage for this class is named output buffers, so that you can buffer multiple pieces of a page and then output them later in specific places., (*2)

start('block1');
echo 'This is in block 1';
$bufferManager->end();

$bufferManager->start('block2');
echo 'This is in block 2';
$bufferManager->end();
?>


This is block 1's heading

get('block1'); ?>

This is block 2's heading

get('block2'); ?>

Here is an example for an HTML document, illustrating how it might be used to output the buffers in an HTML document, or in a JSON representation of that document if the request is via AJAX., (*3)

start('main');
include($mainContentFile);
$bufferManager->end();
$bufferManager->start('aside');
include($asideContentFile);
$bufferManager->end();

if($isAjaxRequest){
    echo json_encode(Array(
        'title'=> $pagetitle
        ,'main'=> $bufferManager->get('main')
        ,'aside'=> $bufferManager->get('aside')
    ));
}else{
?>
<!DOCTYPE html>
<html>
    <title><?=$pagetitle?></title>
    …
    <main><?=$bufferManager->get('main')?></main>
    <aside><?=$bufferManager->get('aside')?></aside>
    …
</html>

The Versions

03/12 2014

0.1.x-dev

0.1.9999999.9999999-dev

Manager of PHP output buffers

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3

 

03/12 2014

dev-master

9999999-dev

Manager of PHP output buffers

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3

 

03/12 2014

v0.1.0

0.1.0.0

Manager of PHP output buffers

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.3