17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2497 Views |
-
Assigning temporary variables in a template?

30 October 2008 at 8:04am Last edited: 30 October 2008 8:16am
I have a folder called "clientcases" that includes 4 or five client cases. In the template I list the other clientcases in the sidebar (with a <% control ChildrenOf(clientcases) %> loop ). Now I want to exclude the current case from the list in the sidebar. Normally I'd just assign a temporary CurrentClientCase variable to match against the Title in the loop. But how do I assign a temporary variable like that in SS?
Example:
Clientcases
- Foo
- Bar
- Alice
- BobWhen viewing the "Foo" page, only Bar, Alice and Bob should be listed in the sidebar.
So something like this should do it:
<% control ChildrenOf(clientcases) %>
<% if Title != CurrentClientCase %>
...
<% end_if %>
<% end_control %>But how do I assign the $Title value to $CurrentClientCase (or another temp variable...)?
/Jens
-
Re: Assigning temporary variables in a template?

30 October 2008 at 2:42pm
You can't assign vars in the template parser. But if you want to hide the current one you could just do <% if LinkOrCurrent = Current %><% else %>// do stuff <% end_if %>
-
Re: Assigning temporary variables in a template?

30 October 2008 at 11:10pm
Great, that did the trick. "Current" has to be in lowercase for this to work though. So:
<% control ChildrenOf(clientcases) %>
<% if LinkOrCurrent = current %><% else %>
<h2>$Title</h2>
<% end_if %>
<% end_control %>...does exactly what I want.
Thanks a lot!
| 2497 Views | ||
|
Page:
1
|
Go to Top |


