mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
...
parent
457c96dbd2
commit
201c637bf9
54
Taco-Class---The-power-of-jQuery-all-wrapped-up-in-a-Codeigniter-Library.md
Executable file
54
Taco-Class---The-power-of-jQuery-all-wrapped-up-in-a-Codeigniter-Library.md
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
[color=green][size=4][b]The Taco class for codeigniter.[/b] [/size][/color]
|
||||||
|
[color=green]——————————————————————————————————————————————————-[/color]
|
||||||
|
You can see a demonstration of this libaray at http://findmeonthe.net/TACONITE/
|
||||||
|
It has lots of examples and the source code is dowloadable.
|
||||||
|
[color=green]——————————————————————————————————————————————————-[/color]
|
||||||
|
[size=3][color=blue]Updated to version:- 4.05[/color][/size]
|
||||||
|
|
||||||
|
What does this class do:
|
||||||
|
|
||||||
|
- [b]Manipulate html elements from within your controller [/b]
|
||||||
|
- [b]Transmit data via AJAX[/b]
|
||||||
|
- [b]Send JQUERY commands e.g. slideUp, fade, show, hide, replaceWith, append, etc etc. to munipulate your webpages, without reloading the pages[/b]
|
||||||
|
|
||||||
|
This class simply generates an xml file that allows you to take control of your webpage.
|
||||||
|
|
||||||
|
For this to work you need the [url=http://jquery.com]JQUERY [/url]library and the Taconite library from [url=http://malsup.com/jquery/taconite]malsup.com[/url] added to your [VIEW] file.
|
||||||
|
|
||||||
|
[b]The power behind this library is the Taconite Plugin for JQUERY which is well documented on the [url=http://malsup.com/jquery/taconite]MALSUP[/url] website.[/b]
|
||||||
|
|
||||||
|
This example shows how you can easily manipulate the structure of the DOM. The markup is as follows.
|
||||||
|
|
||||||
|
[color=red][size=3]In the view file[/size][/color]
|
||||||
|
|
||||||
|
[code]<div id="example1" style="background-color: #ffa; padding:10px; border:1px solid #ccc">
|
||||||
|
This is the <span style="color:#800">structure example</span> div.
|
||||||
|
</div>
|
||||||
|
[/code]
|
||||||
|
The following code is used in the view to request example1:
|
||||||
|
[code]
|
||||||
|
$('#MYBUTTON').click(function() {$.get('http://findmeonthe.net/TACONITE/index.php/taco_example/example1'); });
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
[color=red][size=3]In the controller the php code[/size][/color]
|
||||||
|
[code]
|
||||||
|
function example1()
|
||||||
|
{
|
||||||
|
$this->taco->set('after', '#example1', 'This text will go AFTER the example div.');
|
||||||
|
$this->taco->set('before', '#example1', '<div>This div will go BEFORE the example div.</div>');
|
||||||
|
$this->taco->set('wrap', '#example1 span', '<span style="border: 1px dashed #00F"/>');
|
||||||
|
$this->taco->set('append', '#example1', '<div>This div is APPENDED</div>');
|
||||||
|
$this->taco->output();
|
||||||
|
}
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
[color=red][size=3]The browser ouput is[/size][/color]
|
||||||
|
[code]
|
||||||
|
<div>This div will go BEFORE the example div.</div>
|
||||||
|
<div id="example1" style="border: 1px solid rgb(204, 204, 204); padding: 10px; background-color: rgb(255, 255, 170);">
|
||||||
|
This is the <span style="border: 1px dashed rgb(0, 0, 255);">
|
||||||
|
<span style="color: rgb(136, 0, 0);">structure example</span>
|
||||||
|
</span> div.
|
||||||
|
<div>This div is APPENDED</div>
|
||||||
|
</div>This text will go AFTER the example div.</div>
|
||||||
|
[/code]
|
Loading…
x
Reference in New Issue
Block a user