2017 © Pedro Peláez
 

library ResponseRender

A plugin component for Pupcake Framework to render different types of templates

image

Pupcake/ResponseRender

A plugin component for Pupcake Framework to render different types of templates

  • Tuesday, July 3, 2012
  • by jimthunderbird
  • Repository
  • 0 Watchers
  • 0 Stars
  • 42 Installations
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PupcakeResponseRender

Pupcake Response Render is a Plugin to allow the response object in Plugin Express Plugin to render different types of templates., (*1)

Installation:

install package "Pupcake/ResponseRender" using composer (http://getcomposer.org/)

Usage

We can simply call render([viewpath], [data]) on the response object, (*2)

usePlugin("Pupcake.ResponseRender");

$app->on("node.edit.form.fields", function(){
    $fields = array();

    $fields[] = array('type' => 'textfield', 'id' => 'title');
    $fields[] = array('type' => 'textbox', 'id' => 'body');
    $fields[] = array('type' => 'textbox', 'id' => 'summary');
    $fields[] = array('type' => 'image_upload', 'id' => 'logo', 'maxsize' => '2MB');
    $fields[] = array('type' => 'embed_video', 'id' => 'youtube-video', 'provider' => 'youtube');

    return $fields;
});

$app->get("node/:id/edit", function($req, $res) use ($app) { 
    $data = array();
    $data['fields'] = $app->trigger("node.edit.form.fields"); //the node edit form creation
    $res->render("../views/index.tpl.php", $data);
});

$app->run();
```

Then here is the corresponding index.tpl.php 
```html 
{ ?>
    <h1><?php echo $fields; ?></h1>

The Versions

03/07 2012

dev-master

9999999-dev https://github.com/superjimpupcake/PupcakeResponseRender

A plugin component for Pupcake Framework to render different types of templates

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • pupcake/pupcake *

 

micro framework lightweight microframework view rendering