ful_ajax_gallery
Description
This plugin helps to create a dynamic archive browsing using ajax, it uses ajax to query the textpattern db and to retrieve post information such title, text and whatever.
The plugin is strongly ispired on the cbs_live_search but it doesn't use hardcoded query. So you can choose how to display your results simply creating a new layout form.
Release
v0.7
Download
Demo
http://php.fullo.net/textpattern/ click on "next" to start the demo
Reference
css style
Every object created by the plugin has its own css ID:
- menu and menu links: ajax-menu, ajax-menu-next, ajax-menu-prev
- title browsing (bottom interface): ful-ajax-bottom
- article content: ful-ajax-top
- spinner: ful-ajax-spinner
usage example
create a layout page, cloning the default template. Add then in the html head section the calling for the js libraries.
note that I\'ve installed prototype and scriptaculous in the /js directory
PHP:
-
<script type="text/javascript" src="<txp:site_url/>js/prototype.js"></script>
-
<script type="text/javascript" src="<txp:site_url/>js/scriptaculous.js"></script>
-
<txp:full_ajax_gallery_js />
then in the body of the page I add the tag to create the ajax gallery
PHP:
-
<h1>ajax article gallery</h1>
-
<txp:ful_ajax_gallery limit="5" category="mycat" form="myform" />
now an archive gallery for the category mycat is created by textpattern, and I have also a 5 title pagination.
The archive uses a generic article form myform
PHP:
-
<div class="articolo">
-
<txp:ful_ajax_show_link form="myTopForm">##<txp:article_id />##<txp:title />&</txp:ful_ajax_show_link />
-
</div>
it is very important that the value inserted in the ful_ajax_show_link tag start with ##ID-OF-THE-POST## This is due a
textpattern limitation which cannot permit to use a txp:tag inside another txp:tag as attribute. After that pattern you can add anything.
Here I use a article form called myTopForm.
PHP:
-
<h2><txp:permlink><txp:title /></txp:permlink></h2>
-
<txp:body />
if you want to add the spinner or the top container in another place you can change the page layout as follow:
PHP:
-
<txp:ful_ajax_spinner><img src="path.to/spinner.img" alt="my ajax spinner" /></txp:ful_ajax_spinner>
-
-
<txp:ful_ajax_menu label="prev" limit="5" category="mycat" form="myform" menu="false" />
-
<txp:ful_ajax_menu label="next" limit="5" category="mycat" form="myform" menu="false" />
-
-
// some html code here
-
-
<h1> ajax article gallery </h1>
-
<txp:ful_ajax_gallery limit="5" category="mycat" form="myform" spinner="false" top="false" menu="false"/>
-
-
// some html code here
-
<txp:ful_ajax_top class="myCSS" tag="p">SOME TEXT HERE</txp:ful_ajax_top>
note that is very important to add the same attributes to the ful_ajax_menu and ful_ajax_gallery tags.
note: This plugin need the scriptacoulus and prototype js libraries loaded in the head of your site template