Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Assigning temporary variables in a template?

Go to End

3 Posts   4195 Views


Community Member, 53 Posts

30 October 2008 at 8:04am

Edited: 30/10/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?


- Foo
- Bar
- Alice
- Bob

When 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...)?



Forum Moderator, 5523 Posts

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 %>


Community Member, 53 Posts

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 %>
<% end_if %>
<% end_control %>

...does exactly what I want.

Thanks a lot!