# --- BEGIN PLUGIN HELP ---
<txp:ful_ajax_gallery_js />
it will add the necessaries javascript function to call ajax with prototype and scriptacoulus<txp:ful_ajax_gallery />
tag is the main tag of the plugin. <txp:ful_ajax_menu>
it uses a limited sets of the attributes of <txp:ful_ajax_gallery />
<txp:ful_ajax_gallery />
and then you can use <txp:ful_ajax_top />
.
This tag accept 2 attributes and can manage text.
<txp:ful_ajax_gallery />
and then you can use <txp:ful_ajax_spinner />
.
This tag accept 2 attributes and can manage text.
ful_ajax_config()
array.
<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
<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
<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.
<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:
<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
# --- END PLUGIN HELP --- $id, 'form'=> $form ); $o = array(); $o[] = article_custom($args); exit(doWrap($o, $wraptag, $break)); } // this function is called from the ajax script , calling it from a txp tag isn't a good idea function ful_ajax_next() { if((ps('ful_next')) == '') return; $limit = (int)ps('limit'); $original_offset = (int)ps('offset') - $limits ; $offset = (int)ps('offset') + $limits; $section = ps('section'); $category = ps('category'); $form = ps('form'); $menu = ps('menu'); $break= ""; header('Content-Type: application/x-javascript; charset=ISO-8859-1'); global $prefs; $args = array ( 'limit' => $limit, 'form'=> $form, 'offset'=> $offset, 'sortby'=> 'posted', 'section'=> $section, 'category'=> $category, 'menu' => $menu ); $o = array(); $o[] = article_custom($args); if ($menu == 'true') { $o[] = ' '; } exit(doWrap($o, $wraptag, $break)); } // this function is called from the ajax script , calling it from a txp tag isn't a good idea function ful_ajax_next_menu() { if((ps('ful_next_menu')) == '') return; $limit = (int)ps('limit'); $original_offset = (int)ps('offset') - $limits ; $offset = (int)ps('offset') + $limits; $section = ps('section'); $category = ps('category'); $form = ps('form'); $menu = ps('menu'); $break= ""; header('Content-Type: application/x-javascript; charset=ISO-8859-1'); global $prefs; $args = array ( 'limit' => $limit, 'form'=> $form, 'offset'=> $offset, 'sortby'=> 'posted', 'section'=> $section, 'category'=> $category, 'menu' => $menu ); $o = array(); if ($original_offset >= 0) $o[] = ful_ajax_menu(array_merge($args, array('label'=>'prev')),'prev'); $o[] = ful_ajax_menu(array_merge($args, array('label'=>'next')),'next'); exit(doWrap($o, $wraptag, $break)); } // add the js function to call the ajax script, add this in the header of your template function ful_ajax_gallery_js(){ return ' '; } //generate the next, prev menu link button function ful_ajax_menu($atts) { extract(lAtts(ful_ajax_config(),$atts)); if (!in_array(strtolower($label),array('next','prev'))) $label='next'; if (strtolower($label) == 'next') $offset = $offset + $limit; if (strtolower($label) == 'prev') $offset = $offset - $limit; if ($offset < 0) return ''; else return ' '.${'label_menu_'.$label}.' '; } function ful_ajax_show_link($atts,$value){ $string = parse($value); extract(lAtts(ful_ajax_config(),$atts)); if ($id == '') { ereg('^##[0-9]+##',$string,$newid); $id = ereg_replace('##','',$newid[0]); $string = ereg_replace('^##[0-9]+##','',$string); } return ' '.$string.' '; } // main function to show the divs for the ajax gallery function ful_ajax_gallery($atts) { extract(lAtts(ful_ajax_config(),$atts)); if ($category != '') $add_category = 'category='.$category; if ($section != '') $add_section = 'section ='.$section ; if ($spinner == 'true') $show_spinner = '