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, biapar, Willr, Ingo, simon_w

Control scope


Reply

21 Posts   6907 Views

Avatar
mallbeury

13 September 2008 at 11:29pm Community Member, 7 Posts

Hi, we have version 2.2.2 and $Top does not seem to do anything. Can you confirm it still works?

We're trying to build a pretty in depth site (http://fiction.previews.umguk.vvhp.net/staging/) but without $Top working we're a little stuck.

This is an example that does not work:

$Title
<% control Menu(1) %>
<% control children %>
$Top.Title
<% end_control %>
<% end_control %>

The $Top.Title displays nothing.

Hope you can help.

Avatar
Willr

13 September 2008 at 11:46pm Forum Moderator, 5511 Posts

Maybe $top is in trunk or removed.. you can do <% control Level(1) %>$Title<% end_control %. to get the topmost then

Avatar
mallbeury

15 September 2008 at 8:15pm Community Member, 7 Posts

Thanks for such a speedy reply, that does indeed allow me to reference built in values.

I was hoping it would give me the context of the ContentController, so I can call functions.

I'm trying to call functions as I would normally do before entering into the scope of a 'control', but it seems this is only possible before you use a 'control' block.

Is there another way I can reference functions of the ContentController once we're inside a 'control'? This is really important to the sites we build and severely limiting if this is not possible.

Matt

Avatar
Fuzz10

15 September 2008 at 9:47pm Community Member, 787 Posts

try placing your functions in the Page class instead of the controller class.

That often makes the methods reachable ...

Avatar
mallbeury

15 September 2008 at 11:35pm Community Member, 7 Posts

Aha, have got the $Top working! I just downloaded the latest nightly build and it works as I'd hoped, hoorah!

I was relying on the latest stable build 2.2.2 which it seems has lost that feature.

Thanks

Matt