For what it's worth, I'd suggest getting your javascript out of those
links, for graceful degradation:
In your javascript, loop through the links, get the href, and use it to
know which ones to show and hide.

{% for item in site_details.Photos.all %}
        <div class="imgbox" id="img{{ forloop.counter }}">
         <h3>{{item}}</h3>
         <img src="media/photos/thumbs/{{item}}"><br>
        {% if not forloop.first %}
            <a href="#img{{ forloop.counter - 1 }}' );">prev</a>&nbsp;
             {{ forloop.counter|add:"-1" }}
        {% endif  %}
        {% if not forloop.last %}
             <a href="#{{ forloop.counter + 1}}' );">next</a>
             {{ forloop.counter|add:"1" }}
         {% endif  %}
     </div>
{% endfor %}






On Jan 26, 12:02 pm, nesh <[EMAIL PROTECTED]> wrote:
> * AndyB wrote, On 26.01.2007 16:56:
>
> > here's what I've got:
>
> >     {% for item in site_details.Photos.all %}
> >         <div class="imgbox" id="img{{ forloop.counter }}">
> >         <h3>{{item}}</h3>
> >         <img src="media/photos/thumbs/{{item}}"><br>
> >         {% if not forloop.first %}
> >             <a href="javascript:void(0);" onclick="showPhoto('img{{
> > forloop.counter - 1 }}' );">prev</a>&nbsp;{{ forloop.counter|add:"-1" }}
>
> >         {% endif  %}
> >         {% if not forloop.last %}
> >             <a href="javascript:void(0);" onclick="showPhoto('img{{
> > forloop.counter + 1}}' );">next</a>{{ forloop.counter|add:"1" }}
>
>
>
> >         {% endif  %}
> >         </div>
> >     {% endfor %}
> [snip]
> > The trouble is how to get the value of forloop.counter minus one and
> > plus one. My pseudo-code solution obviously doesn't work and I can't
> > suss out the correct syntax using filters. What's the best way to do
> > this (apart from the obvious 'you shouldn't 
> > answer)http://www.djangoproject.com/documentation/templates/#add
>
> --
> Nebojša Đorđević - nesh, ICQ#43799892
> Studio Quattro - Niš - 
> Serbiahttp://studioquattro.biz/|http://trac.studioquattro.biz/djangoutils/
> Registered Linux User 282159 [http://counter.li.org]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to