My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<title>Fluctuate</title>

<link rel="stylesheet" href="blank.css" />

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="fluctuate.js"></script>

<script type="text/javascript">
// exemple contrôle du refresh

$(function()
{
$('#names_refresh').click(function() {

$('#names_list').fluctuate('reloadContent');

return false;
});

});
</script>

</head>
<body>

<h1>Fluctuate</h1>
<p>An AJAX based template engine and CSS helper</p>

<h2>Liste (depuis array statique)</h2>

<ul fluctuate="from:names" id="names_list">
<li value="@this"></li>
</ul>
<a href="#" id="names_refresh">Refresh names</a>

<div post-data="id:3">
<h2>single variable ( where id= ... )</h2>
<div fluctuate="from:whereTest" value="@this.name"></div>
</div>

<h2>Forms (Ajax flavour)</h2>

<div fluctuate="from:maitrises">
<form action="fluctuate.php" method="post">

<fieldset class="@parity">

<input type="hidden" name="form_id" value="@this.id" />

<label>Name</label>
<input type="text" name="name" value="@this.name" />

<label>Stuff</label>
<input type="text" name="stuff" value="@this.stuff" />

<label>Text</label>
<input type="text" name="text" value="@this.text" />

<input type="submit" value="Save" ajax="ajax" />

</fieldset>

</form>
</div>


<h2>Liste </h2>

<ul fluctuate="from:maitrises">
<li value="@this.name"> </li>
</ul>


<h2>Table (refresh = 60 secondes)</h2>

<table border="1" width="800">

<thead>
<th>date</th><th>text</th><th>stuff</th>
</thead>

<tbody fluctuate="from:maitrises, refresh:60">
<tr class="@index @parity">
<td value="@this.date"></td>
<td value="@this.text"></td>
<td value="@this.stuff"></td>
</tr>
</tbody>

</table>

<h2>File include (the ajax way !)</h2>

<div fluctuate="from:included_html"></div>
</body>

</html>

Change log

r11 by pierrick...@zagett.com on Mar 27, 2011   Diff
- Adding function jQuery $.fn.fluctuate()
better jQuery scripting
-
$('selector').fluctuate('refreshContent')
will refresh any *valid* fluctuate
element.
- Example file modification
Go to: 
Project members, sign in to write a code review

Older revisions

r10 by pierrick...@zagett.com on Mar 27, 2011   Diff
[PHP]
- Ajout flag $isFile dans la fonction
assign() pour récupérer le contenu
d'un fichier.
[HTML]
...
r9 by pierrick...@zagett.com on Mar 26, 2011   Diff
- dummy
r8 by pierrick...@zagett.com on Mar 20, 2011   Diff
- any request will extend it's post-
data with all its parents() post-data.
On conflict, the nearest ancestor
value is kept
All revisions of this file

File info

Size: 2295 bytes, 101 lines
Powered by Google Project Hosting