Fullscreen
[Show/Hide Left Column]
[Show/Hide Right Column]

documentation, bugs, feature requests and ideas for ajax framework in tiki (Cached)
Refresh Print

Ajax

Related: Mootools, No Javascript, jQuery


Wishlist

 RatingSubjectPriorityCategoryCreated
closed-2-1012(0)HelpCustom javascript: a future-proof way to handle8Feature request2009-02
open-2-1012(1)Helpajax seems to duplicate the content of wiki page edit under some circumstances8Bug: Error
Bug: Regression
Bug: Usability
2009-09
closed-2-1012(1)Helpmaketoc in tikiwiki 3.2 "amplifies" content after saving?8Bug: Error
Bug: Usability
2009-10
open-2-1012(0)HelpAJAX auto-refresh of preview, options: new window or HTMLdiff8Feature request2009-11
open-2-1012(1)HelpSplit Ajax settings7Bug: Consistency
Feature request
2008-07
open-2-1012(1)HelpEdit button at page's top can't work when i enabled Ajax feature6Bug: Error2009-08
closed-2-1012(1)Helpinsert column or row in spreadsheet requires ajax to work in 3.3, and broken in tiki 4.06Bug: Error
Bug: Regression
Bug: Usability
2010-01
closed-2-1012(1)HelpAjax fails with Quicktags admin5Bug: Error2006-06
open-2-1012(0)HelpWiki page draft broken on Firefox 2.0 and IE65Bug: Error2008-07
closed-2-1012(1)HelpQuicktags don't work on editpage if you use the AJAX edit icon5Bug: Error2009-03
open-2-1012(1)HelpNormal search also with autocomplete-ajax-feature5Feature request2009-09
open-2-1012(0)HelpJavascript bug with Show Help button in tiki-article_types.tpl5Bug: Usability2010-01
open-2-1012(0)Helptiki-stats.php ajax links to anchors broken3Bug: Usability2009-07
closed-2-1012(1)HelpTracker pagination fails in AJAX2Bug: Error
Bug: Usability
2008-06
closed-2-1012(1)HelpSome themes are incomplete1 lowBug: Usability2009-04




Developing Ajax


Ajax framework is under development in v1.10. There are two branches of proposals for this framework, one based in xajax (external link) library and other based on cpaint cpaint (external link). This page describes latest proposition for xajax branch, based on belief that cpaint is a very good transport layer, but we realized that we would have to build the whole development api over it, while xajax provides an easier development. Also, as of 2007-03-15 17:01, cpaint is no longer under active development. (external link)

Table of contents



Getting started


First of all, read xajax 10 minutes tutorial (external link).

To use ajax in tiki:

In php file, after including tiki-setup.php:

require_once("lib/ajax/ajaxlib.php");


this will import xajax and declare in global scope $ajaxlib, an instance of TikiAjax, that's an extension of xajax class.

Before calling $smarty->display("tiki.tpl"):

$ajaxlib->processRequests();


you don't need to worry about assigning getJavaScript() to smarty or any client-side declaration, everything is already handled by tiki.

To declare and register ajax functions in server, create a php file in lib/feature called feature-ajax.php. In this file, declare the functions and register them with $ajaxlib->registerFunction(). If you need a javascript file, create file lib/feature/feature-ajax.js to hold these functions.

Ajax development guidelines


Ajax applications don't work for everybody. It breaks accessibility, don't work with some alternative or old browsers. Considering that, tiki ajax development guidelines aim to:

  1. keep it simple to preserve tiki funcionality and layout with and without ajax
  2. avoid forking code

1 - Template-based common layout


The look & feel of a page must always be the same with or without ajax, and defined by template. Changing the template should change both modes at once as long as html element ids are preserved.

2 - Load content statically first time


If you are delivering empty containers with smarty and then have a document.onLoad() to load data, then you're likely to be breaking directive #1. Load content as if there was no ajax, and then when user request more content you update html element's properties.

Tutorial - make a region dynamic


1- Identify template component


find in your template the block of code that you want to be dynamic.

cut that code, paste in a new template ($includeFile in this example) and include inside an html element:

<div id="elementId">
missing page for plugin INCLUDE

</div>



Now, edit your template and change links like this:

<a href="tiki-feature.php?param=value..">


to

<a {ajax_href template=$includeFile
htmlelement=$elementId}tiki-feature.php?...{/ajax_href}>


where $includeFile is the template to be loaded, and $elementId is the id of element in which template will be loaded.

tip: use doc/devtools/make_ajax_template.pl to apply a regular expression to the template. edit the file and set correct parameters, then make a backup and call

./doc/devtools/make_ajax_template.pl templates/tiki-something.tpl


3- Modify php file to process requests


in beginning of php file, after tiki-setup.php, put:

require_once("lib/ajax/ajaxlib.php");


and at end, before $smarty->display() or any output, register the templates you want to be loaded dynamically and process requests:

$ajaxlib->registerTemplate($template);
$ajaxlib->processRequests();


that's all!
<a rel="dofollow" href="http://www.all-auto.ro/piese-auto" title="piese auto ieftine"><img src="http://www.all-auto.ro/images/piese auto" alt="piese auto ieftine" hspace="2" vspace="2" border="0" /></a>

Features benefiting from ajax


  • tiki-admin_quicktags.php
  • tiki-listpages.php
  • Modules
  • Messages
  • Calendar
  • wiki
    • save draft feature

Todo


  • remove lib/cpaint and ajax/ after community approval

  • reimplement tiki-admin_quicktags.php and tiki-listpages.php without splitting files

  • configure a frequence for each module to be dynamically updated


Contributors to this page: masini28 points  , point016 points  , Torpedro3 points  , marclaporte31761 points  , luci1593 points  and lfagundes365 points  .
Page last modified on Monday 22 February, 2010 12:54:24 UTC by masini28 points .

Main Menu [toggle]


Bugs and Wishes
  1. Report a Bug (or suggest a feature enhancement)

  2. Search Bugs

  3. List yours



About Development

Mailing lists

Extra Stuff

Teams

External Links

Full list of Wiki Pages

TikiWiki on Social Networks


To register [toggle]

To have an account at this site, please register at Tikiwiki.org (external link), and then use that user name and password to log in here.

Search a Wiki Page [toggle]

Exact match

Search Tracker Items Subject [toggle]

Keywords [toggle]

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI – 508)
Action log 2.x
Administration
Ajax 2.x
Alert 3.x
Articles & Submissions
Backlinks
Banner
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution 2.x
Cookie
Copyright
Custom Home (and Group Home Page)
Database independence
Database MySQL
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tikiwiki.org (Help System)
DogFood
Dynamic Content
Dynamic Variable
External Authentication
FAQ
Featured links
File Gallery
Forum
Friendship Network (Community)
Gmap Google maps
Group
Help System
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interaction
Inter-User Messages
InterTiki
jQuery
Karma
Live Support
Lost edit protection
Mail-in
Map with Mapserver
Menu
Meta Tag
Missing features
MindMap 3.x
Mobile Tiki and Voice Tiki
Mods
Module
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Payment 5.x
Performance Speed / Load / Compression / Cache
Permission
Poll
Profile Manager
Quiz
Rating
RSS
Score
Search engine optimization (SEO)
Search
Security
Semantic links 3.x
Shoutbox
Site Identity
Slideshow
Smarty Template
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
System log
Tags 2.x
Task
Tell a Friend + Social Bookmarking 2.x
TikiTests 2.x
Theme
Toolbar (Quicktags)
Trackers
TRIM
User Administration
User Files
User Menu
Watch
WebHelp
Webmail and Groupmail
WebServices 3.x
Wiki 3D
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace Ideas 4.x
WYSIWTSN 4.x
WYSIWYCA
WYSIWYG 2.x
XMLRPC

Last Comments [toggle]

  1. found another one
  2. Home-made fix