Template $FirstLast

Showing 1-3 of 3 messages
Template $FirstLast Isengrim 9/19/12 6:40 AM
I have found a little weird problem.
In SS templates by using loops I can use the Function $FirstLast.
Direct in the loop this funktion shows the right list position for the first or last item.
But when i use an include and call in the included template the funktion $FirstLast it returns in every item 'first last'

Here the example:
Navigation.ss
<% loop Menu(2) %>
<% include MenuItem %>
<% end_loop %>

MenuItem.ss
<li class="$FirstLast"><a href="$Link">$Title.XML</a></li>

Anybody else with the same problem?
Re: [silverstripe-dev] Template $FirstLast anselmdk 9/19/12 10:23 AM
I was wondering about this too today.
It seems includes work a little different in SS3. See the includes section here:

You can now define variables in your include files like this:
<% include MemberDetails PageTitle=$Top.Title, PageID=$Top.ID %>

I think this is one of the very great new features in SS3, once you've gotten used to it you'll need far less include files.


Anselm

--
You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To view this discussion on the web visit https://groups.google.com/d/msg/silverstripe-dev/-/2EQ-pXc8iTgJ.
To post to this group, send email to silverst...@googlegroups.com.
To unsubscribe from this group, send email to silverstripe-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/silverstripe-dev?hl=en.

Re: [silverstripe-dev] Template $FirstLast Isengrim 9/19/12 10:30 AM
Ahh I see I see.
Good to know.
I think that this is a greate feature, too.

Thank you for your response.


Isengrim