Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. Original pastebin here: http://pastebin.com/C3wLEcG3
  2.  
  3. Here's a way around this, which appears to work (at least for template toolkit), but I'm not positive it's actually behaving correctly. Before I implement and depend upon it, I want to make sure this isn't exploiting a bug.
  4.  
  5. Simple example. Define the following routes:
  6. $r->route('test')->to('main#test');
  7. $r->route('embed')->to('main#embed');
  8.  
  9. Create templates:
  10. main/test.txt.tt
  11. main/embed.txt.tt
  12.  
  13. test.txt.tt is this:
  14. ( [% foo %] )
  15.  
  16. embed.txt.tt is this:
  17. [% foo = 'This is the foo value' %]
  18. [% c.render('main/test', 'partial', 1) %]
  19.  
  20. in your browser, going to something.com/test yields output of "()", which makes sense since foo is undefined.
  21. But going to something.com/embed yields output of "(this is the foo value)", which means that somehow the render call from within the TT environment is picking up the value of the foo variable set above it.
  22.  
  23. This may be the desired effect (I'm unfamiliar enough with the TT and Mojo guts to know if this is expected good behavior), or it may be a bug.
  24.  
  25. I'm perfectly content to use this approach, but I want to make sure it's not going to get yanked out from under me.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement