Template $FirstLast

47 views
Skip to first unread message

Isengrim

unread,
Sep 19, 2012, 9:40:13 AM9/19/12
to silverst...@googlegroups.com
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?

Anselm Christophersen

unread,
Sep 19, 2012, 1:23:32 PM9/19/12
to silverst...@googlegroups.com
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.

Isengrim

unread,
Sep 19, 2012, 1:30:55 PM9/19/12
to silverst...@googlegroups.com
Ahh I see I see.
Good to know.
I think that this is a greate feature, too.

Thank you for your response.


Isengrim
Reply all
Reply to author
Forward
0 new messages