17452 Posts in 4473 Topics by 1971 members
|Go to End||Next >|
15 June 2008 at 12:55pm
Yeah totally a important thing to have access to for sites with rather complicated data relationships. (Well, 3 levels isn't that complicated really!). I know Smarty pumps out a large series of arrays that are accessable anywhere simply by calling $firstLevel['value'], $secondLevel['value'] etc.
I'll keep an eye on the changelogs. If you remember, it'd be cool to post any further developments on this here, as this limitation will be a pretty important factor in choosing SS for complicated client requirements for us. I still don't really understand the context of Ingo's work-around.
15 June 2008 at 1:08pm Last edited: 15 June 2008 1:09pm
Ok so your on a Page with fields like $Title, $URLSegment etc so in PHP terms $Page->Title etc. These are fields / methods on the Page Object. Ingos method is adding the Page Object on to the Member Object. So that $Page->Title or $Title on the 'parent level' (the title field on the Page object) can be called within that member control By $ParentScope.Title or you can then add another control inside member to go back up a level
$Title // "Test"
<% control Member %>
$Title // Member doesnt have a Title
$ParentScope.Title // "Test"
<% end_control %>
As you added the Parent Object (in this case Page) to the member object using customize(). It 'appends' the current Object ($this) to the Member Object to a variable called ParentScope. Which is what you can call to access parent elements.
'ParentScope' => $this //
Hope thats not too confusing. Even if it doesnt have paragraph breaks!
15 June 2008 at 1:13pm
Ah, I think I'm getting it. The thing I was having trouble following is just what "Members" actually was.
I am assuming that the "Members" object in Ingo's example extends the Parent that we are trying to gain access to?
15 June 2008 at 1:21pm
Members can be any other Object. In this examples Members is just a Member on the Site. But you can append with customize to any other dataobject. Like a latest news feed, or any other Object you are returning
15 June 2008 at 3:37pm Last edited: 15 June 2008 3:39pm
The parent scope can be accessed using $Top, as well. This method doesn't require any additional custom code, as $Top is a built in control.
<% control Members %>
<% end_control %>
$Top.Title will return the same as $Title outside of the <% control Members %> scope.
15 June 2008 at 3:43pm
This was raised like 4 posts ago sean, geez Sean read the whole thread!
15 June 2008 at 3:45pm
LOL. Easy now.....
13 August 2008 at 4:46am
Great discussion, but it not seems to be the answer of the question, because OK I can use prefix Top and probably I'll get access to something from parent, but how can I manipulate the value for example by parent function with just one or two arguments..it's very important to me because i've been looking for it for 2 hours, changing code and NOTHING it should not very difficult but very useful. could anyone help me cope with it?
|Go to Top||Next >|