What I meant was that you could use the catch tag to avoid having to
use html comments to hide it. (:

It's still just as much of a hack, of course, but not quite as visible
after rendering.

On Feb 28, 3:51 am, itpaul <[EMAIL PROTECTED]> wrote:
> ok. like this?
>
> {% for p in post_list %}
>         <li style="background-color: {% cycle 'red' 'blue' as bgcolor %}{%
> catch as caughtvar %}{{ bgcolor }}{% endcatch %}">
>             blah...
>     </li>
> {% endfor %}
> {{ caughtvar }}         <------ contains nothing
>
> also tried like this:
>
> {% cycle 'red' 'blue' as bgcolor %}{% catch as caughtvar %}{% cycle
> bgcolor %}{% endcatch %}
>
> and like this:
>
> {% catch as caughtvar %}{% cycle 'red' 'blue' as bgcolor %}{% endcatch
> %}
>
> but alas nothing worked :(
>
> is this what you meant or I am i missing something?
>
> On Feb 27, 9:43 pm, JeremySandell<[EMAIL PROTECTED]> wrote:
>
> > Unless I've misunderstood what you're trying to do, this tag should do
> > what you're needing:
>
> >http://code.djangoproject.com/wiki/CatchTag
>
> > Hope this helps!
>
> > On Feb 27, 2:01 pm, itpaul <[EMAIL PROTECTED]> wrote:
>
> > > Big headache. Cycles "context" var seems to be available only in the
> > > loop its declared in. I need access to it in a template tag thats
> > > outside the loop. (There's some waffle about being "nesting safe"
> > > somewhere. Really...)
>
> > > Ive hacked about a bit and worked out that if I declare the
> > > variable(s) to be used by cycle *before* the loop (you need a custom
> > > tag to set context variables for this 
> > > -http://code.djangoproject.com/ticket/1322
> > > ), I can get at them inside and back out the other end...
>
> > > with one major caveat...
>
> > > I have to access it ( {% cycle bgcolor %} ) again before it will stick
> > > the variable back in the context. Sadly, by doing this, you have to
> > > print the value out.
>
> > > hack complete ####################
>
> > > before i finished writing this post i realised i could just use html
> > > comments to hide it:
>
> > > <!--{% cycle bgcolor %}-->
>
> > > I'm posting anyway in case anybody finds it useful and in the hope
> > > that someone knows how to avoid this ugliness.
>
> > > [mumble]...nesting safe...[/mumble]
--~--~---------~--~----~------------~-------~--~----~
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