Skip to content

Commit cdd421f

Browse files
author
syam vilakudy
committed
Updated with template class example
1 parent 75fc36b commit cdd421f

File tree

3 files changed

+46
-10
lines changed

3 files changed

+46
-10
lines changed

Templates/helloworld.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div>
2+
<?php echo $title ?>
3+
<p><?php echo $description ?></p>
4+
5+
</div>

demo.html

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html xmlns="http://www.w3.org/1999/xhtml">
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5-
<title>Untitled Document</title>
5+
<title>Syamvilakudy/Jax - Light weight fast ajax system using azrul-ajax</title>
66

77
<script language="javascript" src="http://code.jquery.com/jquery-1.9.1.js" ></script>
88
<script language="javascript">
@@ -29,18 +29,38 @@
2929
<div id="div1"></div>
3030
<div id="div2"></div>
3131
<div id="div3"></div>
32+
<div id="div4"></div>
3233

3334

3435
<div id="alltriggers">
35-
<h1><a href="javascript:void(0)" onclick="jax.call('test','test,alertCall');">
36-
Alert response from server [ jax.call('test','test,alertCall'); ]
37-
</a> </h1>
38-
<h1> <a href="javascript:void(0)" onclick="jax.call('test','test,emptyCall');">
39-
Response without argument call [ jax.call('test','test,emptyCall'); ]</a> </h1>
40-
<h1> <a href="javascript:void(0)" onclick="jax.call('test','test,argumentCallSingle',1);">
41-
Response with single argument [ jax.call('test','test,argumentCallSingle',1); ]</a> </h1>
42-
<h1> <a href="javascript:void(0)" onclick="jax.call('test','test,argumentCallMultiple',1,2);">
43-
Response with multiple argument [ jax.call('test','test,argumentCallMultiple',1,2); ]</a></h1>
36+
<h1>
37+
<a href="javascript:void(0)" onclick="jax.call('test','test,alertCall');">
38+
Alert response from server [ jax.call('test','test,alertCall'); ]
39+
</a>
40+
</h1>
41+
<h1>
42+
<a href="javascript:void(0)" onclick="jax.call('test','test,emptyCall');">
43+
Response without argument call [ jax.call('test','test,emptyCall'); ]
44+
</a>
45+
</h1>
46+
47+
<h1>
48+
<a href="javascript:void(0)" onclick="jax.call('test','test,argumentCallSingle',1);">
49+
Response with single argument [ jax.call('test','test,argumentCallSingle',1); ]
50+
</a>
51+
</h1>
52+
53+
<h1>
54+
<a href="javascript:void(0)" onclick="jax.call('test','test,argumentCallMultiple',1,2);">
55+
Response with multiple argument [ jax.call('test','test,argumentCallMultiple',1,2); ]
56+
</a>
57+
</h1>
58+
59+
<h1>
60+
<a href="javascript:void(0)" onclick="jax.call('test','test,outputFromTemplate');">
61+
Response with multiple argument [ jax.call('test','test,outputFromTemplate'); ]
62+
</a>
63+
</h1>
4464
</div>
4565

4666

response/test/test.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,15 @@ function argumentCallMultiple($value1,$value2)
2929
return $response->sendResponse();
3030
}
3131

32+
function outputFromTemplate()
33+
{
34+
$tmpl = new Template();
35+
$html = $tmpl->set('title','Hello World')
36+
->set('description','This Content Is Fetch From A Template')
37+
->fetch('helloworld.php');
38+
$response = new JAXResponse;
39+
$response->addAssign('div3','innerHTML', $html);
40+
return $response->sendResponse();
41+
}
42+
3243
}

0 commit comments

Comments
 (0)