Ajax + php sample

View: New views
6 Messages — Rating Filter:   Alert me  

Ajax + php sample

by maikel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm trying to get my head around how to load images not from a textfile, but from a php script. Is this even possible?

The problem is that I have 100+ images loading into jcarousel, and it's slowing everything down, so it would be better to load the images only when asked for. Does anyone maybe have an example of how to do this via php?

Thanks in advance!

Re: Ajax + php sample

by Jan Sorgalla :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
maikel wrote:
Hi,

I'm trying to get my head around how to load images not from a textfile, but from a php script. Is this even possible?

The problem is that I have 100+ images loading into jcarousel, and it's slowing everything down, so it would be better to load the images only when asked for. Does anyone maybe have an example of how to do this via php?

Thanks in advance!
i've j ust updated jCarousel and added a new example that shows how to load items from a PHP script.
http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax_php.html

Jan

Re: Ajax + php sample

by Jan Sorgalla :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

you emailed me directly, so i quote your email here:

maikel wrote:
Thank you so much, but I'm a bit puzzled as to what the php file should look like. The way I now get the xml is to get all files (200+), but I guess 'first'
and 'last' act as the limiter. Can you please give a clue on how to do the php?

Thanks in advance!!

Maik
The line

$selected = array_slice($images, $first, $length);

extracts the part from the array limited by $first and $last.
So, only the requested range is outputted as xml.

Jan

Re: Ajax + php sample

by maikel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Jan,

I only realized I sent you a direct email after I hads send it. Sorry bout that.

About the line you're referring to: maybe I'm missing something, but there's no php file included, so I still don't know how to implement it. A view of 'dynamic_ajax_php.php' could really help out.

#EDIT# I feel stupid. Didn't download the new jCarousel.zip. Got it now #EDIT#


Also, I was using another example of the code, which included a way to start the carousel at a custom point (itemFirstInCallback: {onAfterAnimation: mycarousel_itemFirstInCallback}). But now I can't figure out where to put this code.

You can check a working sample of the code here to see what I am using it for, and what's the general idea.

Maik


Jan Sorgalla wrote:
Hi,

you emailed me directly, so i quote your email here:

maikel wrote:
Thank you so much, but I'm a bit puzzled as to what the php file should look like. The way I now get the xml is to get all files (200+), but I guess 'first'
and 'last' act as the limiter. Can you please give a clue on how to do the php?

Thanks in advance!!

Maik
The line

$selected = array_slice($images, $first, $length);

extracts the part from the array limited by $first and $last.
So, only the requested range is outputted as xml.

Jan

Re: Ajax + php sample

by Jan Sorgalla :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


maikel wrote:
Also, I was using another example of the code, which included a way to start the carousel at a custom point (itemFirstInCallback: {onAfterAnimation: mycarousel_itemFirstInCallback}). But now I can't figure out where to put this code.

You can check a working sample of the code here to see what I am using it for, and what's the general idea.
you can pass it as an option with the new version, see:
http://sorgalla.com/projects/jcarousel/examples/static_start.html

Jan

Re: Ajax + php sample

by maikel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah, I guess it wouldn't hurt to read the changelog ;-)

Danke schon!

Maik


Jan Sorgalla wrote:
maikel wrote:
Also, I was using another example of the code, which included a way to start the carousel at a custom point (itemFirstInCallback: {onAfterAnimation: mycarousel_itemFirstInCallback}). But now I can't figure out where to put this code.

You can check a working sample of the code here to see what I am using it for, and what's the general idea.
you can pass it as an option with the new version, see:
http://sorgalla.com/projects/jcarousel/examples/static_start.html

Jan