jcarousel with jcarousel_ajax.php for loading lots of images

I need an option to not preload all the jcarousel thumbnails as they will grow overtime.
Had a look on the original's jcarousel website and found the dynamic ajax example with the option to remove items which are outside the visible range from the DOM.
http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax_php.html

To my joy the ZP extension came with jcarousel_ajax.php
So I changed the scripts to use this loading technique as show on sorgalla.com

But than when testing I notice the function
'$items = jcarousel_getItems($limit, $offset);'
does not work because the included file is not found...
`include_once 'jcarousel_functions.php';`
I can't find this file anywhere, not in the latest download, not online.

btw Just another question, if I have modified this extension I should move it over to the 'plugin' folder instead of the 'zp-core/zp-extensions' folder right?

Comments

  • acrylian Administrator, Developer
    I don't know or remember why the include_once is there at all. I think this file is not even needed as not used at all. Probably forgotten to be removed...

    The plugin itself uses already the script from the included example "dynamic_ajax.html" in the plugin main file. Which is of course not exactly what you need.

    To the other question: Yes, actually you should place custom versions of a plugin or custom plugins within the /plugins folder. But some plugins may need adjustments as the path to load their additional js files is different then. jCarousel uses `WEBPATH.'/'.ZENFOLDER.'/'.PLUGIN_FOLDER;` to get these but in /plugins that would need to be `WEBPATH.'/'.USER_PLUGIN_FOLDER` instead.
  • Hi I think the include file is needed for the `jcarousel_getItems()` function.
    This include is probably needed to create the album object and get the `$limit, $offset` images.
    No problem, I will write something myself to not preload all the images from the album.

    Thanks for the definition USER_PLUGIN_FOLDER tip!
  • acrylian Administrator, Developer
    Yes, but I have no idea what file is meant to be included in it.

    Your change might make sense, so maybe after 1.4.2 is out it could be incorporated or made optional.
  • I just wanted to report that I did some more testing and it seems the thumbnails are only downloaded when using the arrow buttons. So progressively on user request.

    But the mycarousel_itemList JSON is still writen in the HTML output. This will definitely affect the load time of the page using an album with lots of images..
  • acrylian Administrator, Developer
    So you actually wish the images to be removed if you move futher and they become invisible? Haven't looked at this for quite some time. You could open a ticket or if you have time to try to add that yourself that would be of help as well.
  • Ok I will try it myself first.
    I think it's just a matter of stripping the JSON in the DOM.
    Than an Ajax call when using the arrows or pagination.

    btw Now that I tried the Trac system.. I have some small requests, can I open tickets or do I post them here first?
    For example I have some functions where I can't use the output in Javascript because of single/double quotation like document.write('')
  • acrylian Administrator, Developer
    For minor things or questions probably a ticket is too much. We have several functions for encoding like html_encode() and even a js_encode() (which are wrappers of PHP standards naturally). Always look at the documentation if there isn't anything already there.
Sign In or Register to comment.