File: demos/demo_json_init_with_mustache/arrayvalues.data.php

Recommend this page to a friend!
  Classes of Emmanuel Podvin  >  Blapy  >  demos/demo_json_init_with_mustache/arrayvalues.data.php  >  Download  
File: demos/demo_json_init_with_mustache/arrayvalues.data.php
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Blapy
jQuery plugin to load linked pages using AJAX
Author: By
Last change: add data-blapy-template-init-fromproperty and a-blapy-template-init-search options
Date: 4 months ago
Size: 1,042 bytes
 

Contents

Class file image Download
<?php

$purejson = empty($_REQUEST['purejson'])?false:true;

if (!$purejson)
{
	//blapy block
	echo <<<EOT
		<div id="results"
			data-blapy-container="true"
			data-blapy-container-name="results"
			data-blapy-container-content="resultsnew"
		>
EOT;
}

switch($_REQUEST['action'])
{
	case 'one':
		echo <<<EOT
			{firstname: "John",lastname: "Doe"}
EOT;
		break;
	case 'some':
		echo <<<EOT
			[
				{firstname: "John",lastname: "Doe"},
				{firstname: "Nina",lastname: "Hagen"},
			]
EOT;
		break;
	case 'someinresults':
			echo <<<EOT
				{
					"message":"multiple in results",
					"data":{
						"results":[
							{firstname: "John",lastname: "Doe"},
							{firstname: "Nina",lastname: "Hagen"},
						]
					}
				}
EOT;
		break;
	case 'all':
	default:
		echo <<<EOT
			[
				{firstname: "John",lastname: "Doe"},
				{firstname: "Bob",lastname: "Dylan"},
				{blapyIndex:25, firstname: "Peter",lastname: "Rabbit"},
				{firstname: "Nina",lastname: "Hagen"},
			]
EOT;
		break;
}

if (!$purejson)
{
	echo <<<EOT
	</div>
EOT;
}

exit;