Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Ajax: Smarty Ajax Plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
we4tech
Smarty Rookie


Joined: 17 Apr 2005
Posts: 6
Location: Dhaka

PostPosted: Sun Jan 01, 2006 8:15 pm    Post subject: Ajax: Smarty Ajax Plugin Reply with quote

Hi
I am developing Smarty based Ajax plug-in … Though I have interest to release it as an open source project… It will appreciable if you ppl let me know about your interest… in Smarty Ajax… implementation….


Here is some code snaps.... let me know your comments... (is it easy to use or need more flexibility....)

Ajax based Links with Search indexing enabled
Code:

<html>
   <head>
      <title>Test</title>
      
      {*
                    This function will include all required javascript libraries
                      You can define your `EasyAjax` javascript libraries path   just defining "path" attribute
                   *}
      {easy_ajax_init path="../javascripts"}
      
   </head>
   
   <body>
      <h1>Ajax test Page</h1>
      
                  {*
This example will show how to setup own progress bar
NOTE: if you don’t define any progress bar attribute it will generate a
Default progress bar on top of the page…
*}
      <div id="progress_bar" style='display:none'>
         Loading....
      </div>
                   
                     {*
To create ajax based URL
   “update” attribute will contain your defined “id” where it will show the loaded content….
*}
      {easy_ajax_link
         url="static-content/content1.html"
         update="content"
         label="Content 1"
         progressbar="progress_bar" }
      
      {* You also can create Button page link *}
      {easy_ajax_link
         url="static-content/content2.html"
         update="content"
         type="button"
         label="Content 2"
         id="my-link-2"
         style="background-color: white; border: 1px solid #cccccc" }
         
      Link with style:
      {easy_ajax_link
         url="static-content/date.php"
         update="content"
         label="Content 2"
         style="color: red"}
         
         
      <div id="content">
      </div>
   </body>
   
</html>



Ajax based form handling

Code:

<html>
   <head>
      {easy_ajax_init}
   </head>
   
   <body>
   
{*
You can use this block function as normal HTML FORM tag
You have to define “update” attribute to update your selected
Content….
*}
   {easy_ajax_form
      action="file-upload.php"
      method="post"
      enctype="multipart/form-data"
      update="message"
      progressbar="prog-bar"}
      
      Upload<input type="file" name="file" />   
      <input type="submit" value="Upload"/>
   {/easy_ajax_form}
   
   <div id="prog-bar" style="display: none">
      Loading....
   </div>
   <div id="message">
   </div>
   
   </body>
</html>


Thank you
NHM Tanveer Hossain KHan (Hasan)
http://hasan.we4tech.com [Ajax based Wordpress theme]
[/b]
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
pRzemo
Smarty n00b


Joined: 01 Jan 2006
Posts: 3
Location: Poland

PostPosted: Sun Jan 01, 2006 10:58 pm    Post subject: Reply with quote

I am very interested in such plugin.
Can I download it somewhere? Smile
Back to top
View user's profile Send private message Visit poster's website
we4tech
Smarty Rookie


Joined: 17 Apr 2005
Posts: 6
Location: Dhaka

PostPosted: Mon Jan 02, 2006 6:59 am    Post subject: Reply with quote

I will publish this plug-ins tonight....(hopefully)

Thank you keep interest.... feel simplicity....
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
pRzemo
Smarty n00b


Joined: 01 Jan 2006
Posts: 3
Location: Poland

PostPosted: Fri Jan 06, 2006 12:39 pm    Post subject: Reply with quote

What is the estimated time to release this plugin Question
_________________
Cheers,
pRzemo
Back to top
View user's profile Send private message Visit poster's website
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Fri Jan 06, 2006 1:21 pm    Post subject: What AJAX libs are used? Reply with quote

Hi,

this really sounds interesting, but I'd like to know what are the script libraries used to do the job?
There are many excellent JS/AJAX libs - or "DHTML" for that matter - available, proofed to work x-browser, well supported, and a large support by 3rd parties.
To name a few: Prototype, Behavior, script.aculo.us, netWindows ... and XmlHttpRequest-only wrappers: WebFX, Sarissa
And the problem here: Prototype, WebFX and netWindows are not "compatible" among each other, that is one has to decide which one and stick to it to avoid unneccessary duplication of code and functionality.
I finally moved from WebFX over Sarisssa to script.aculo.us (includes Prototype) since the latter offers the most sophisticated functionality.

Which one's the one you (plan to) use for this? Smile

One note: I particually dislike the "easy" prefix. It's supposed to be "easy" by definition, right? Why not just "{ajax_foobar}"?
Or do you plan an "{advanced_and very_compliated_ajax_foobar}" collection of functions? Wink

Have fun,
CirTap
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jan 06, 2006 6:11 pm    Post subject: Reply with quote

@ClrTap: I did a full set of plugins for scriptaculous (nearly eveything it supports up to 1.5) using my SmartyDoc modules. Eventually, I hope to release them. At anyrate, I found scriptaculous fairly easy to integrate. I would be interested to know more about the challenges of trying to integrate with other libraries and if there is any point in a compatability layer.

FWIW, my functions are named like:
Code:
<span id="foo" onclick="{client Effect=Appear}">test</span>
{client Effect=Appear for=foobar}
{client Draggable=foobar revert=true}
{client Droppable=add  for=droparea onDrop=$ondrop hoverclass=barhover}
{client Sortable=create for=foolist tag="LI"}

And can be used inline (as in the span example) or be manually bounded to elements.

Unfortunately, I can't show any more than that for now Sad
Back to top
View user's profile Send private message
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Fri Jan 06, 2006 6:59 pm    Post subject: Reply with quote

Interesting.

I admit I haven't yet get used to add script.aculo.us, Behavior, and for that matter Prototype, in *every* new project that "requires" JavaScript.
I'm so much used to write JS using my own helper-libs for almost 10 years now and it's difficult to break ole habits Wink

And then, using AJAX requires some different approach in writing the server scripts. I don't dare yet to use AJAX on public pages, but only for backend apps or intranets, where I know what browsers people use.

However, IF I remember to use these nice libraries I also stop doing things like this
boots wrote:
<span id="foo" onclick="{client Effect=Appear}">test</span>

in order to get rid of any JS stuff inside the markup that won't run anyway with JS being disabled or unavailable, and use "behavior.js" for that purpose.
Basically doing the same what I assume this one does:
boots wrote:
{client Effect=Appear for=foobar}


Never had such pure HTML and my customers, editing the pages, can't screw up anything <g>
This also drastically reduces the number of {literal}s to zero.

However, it'd be interesting to use Smarty to create some JS "data files" at all using some technique like your {client} function (?). I hate if pages are cluttered with lots of <script> elements.

I was reading your SmartyDoc extension which sounds very nice, but it's comming too late Smile It doesn't fit in my workflow and my custom "Page" class already offers similar functionality.
Still, mind to let me take a peak look in your {client} code? Maybe you can zip what you have (working or not) and send me a download URL via PM? Just to get an impression and possible "inspiration". I'm just curious Smile

CirTap
Back to top
View user's profile Send private message
CirTap
Smarty Pro


Joined: 04 Jun 2003
Posts: 106

PostPosted: Fri Jan 06, 2006 7:14 pm    Post subject: Reply with quote

boots wrote:
I would be interested to know more about the challenges of trying to integrate with other libraries and if there is any point in a compatability layer.

do you mean to have your {client} code use something else but script.aculo.us?
I don't think it's worth writing a compat layer. Compatibility to what?
I haven't heard of any other library offering so much as script.aculo.us (and Prototype) -- most just do similiar things in a different way (object extensions), but speaking of "Special FX": what else is available?

WebFX have some nice stuff, but to me it always seems to be either too complicated, too specialized, with too many prerequisites, and a PITA to implement in most cases. Dynamic Tabs are the only ones I use.

And of course "overlib" is useful, too.

CirTap
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Jan 06, 2006 7:43 pm    Post subject: Reply with quote

@ClrTap: I agree with your comments and included those inline features because they seem requisite for "simple" uses. OTOH, I tend to agree that the behaviours approach is much cleaner and I favour it as well (and I to like the behaviours library, BTW). Mostly I like the fact that it does for scripting what CSS does for styling -- abstracts it away from the document. Makes sense to me.
Back to top
View user's profile Send private message
Boby
Smarty Rookie


Joined: 21 Jan 2006
Posts: 21

PostPosted: Sun Mar 19, 2006 7:49 pm    Post subject: Reply with quote

Hello!

Is there any link to this plugin or a similar AJAX plugin for Smarty? Or a name?
I have now found it in the plugin list.
Can hardly wait to see one and test it, probably use it too Wink

Thank you!

Boby
_________________
My Homepage: www.frozenminds.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP