I just put this simple text / image rotate script together and thought I
would share ...
<div id="testimonial"></div>
<script>
pu = new Ajax.PeriodicalUpdater('','/ajax/testimonial.php',{
method: 'post',
frequency: 7,
parameters: 'last=',
evalJSON: 'force',
onSuccess: function (t){
if(t.responseJSON['next_id']==null)
{
pu.stop();
} else {
var qstr = 'last='+ t.responseJSON['next_id'];
pu.options.parameters = qstr.toQueryParams();
$('testimonial').hide();
$('testimonial').update(t.responseJSON['testimonial']);
$('testimonial').appear({ duration: 3.0 });
pu.frequency = t.responseJSON['delay'];
pu.registerCallback();
}
}
});
</script>
Probably better ways to do this.
The php part is just an sql call with 'where next_id > $last'. I put
together a simple form for non techies to add testimonials and images.
Hope this helps someone.
Jimmy
On Thu, Mar 4, 2010 at 7:17 AM, Eric <[email protected]> wrote:
> Didn't you mean :
> > this.frequency = frequency;
>
> :o)
>
> Thanks for the snippet!
>
> Eric
>
> On Feb 21, 8:14 am, Радослав Станков <[email protected]> wrote:
> > There isn't PeriodicalExecuter#start method its
> > PeriodicalExecuter#registerCallback
> >
> > You can do:
> >
> > <code>
> > x.stop();
> > x.frequency = 1;
> > x.registerCallback();
> > </code>
> >
> > You can also do:
> >
> > <code>
> > PeriodicalExecuter.addMethods({
> > changeFrequency: function(frequency){
> > this.stop();
> > this.frequency = 1;
> > this.registerCallback();
> > }});
> >
> > </code>
> >
> > an then just call:
> >
> > <code>
> > x.changeFrequency(1);
> > x.changeFrequency(whatever);
> > </code>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<prototype-scriptaculous%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.