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

Accessing variables within a <control>


Reply


7 Posts   2406 Views

Avatar
Fuzz10

Community Member, 787 Posts

21 September 2007 at 8:35pm

Hi !

I'm currently working on a dual-language website. I tied the word-list to the homepage so the user can maintain this list themselves. Accessing theses variables in the template works like a charm, except when I'm in a control block.

Here's an example (I'm in the homepage template):

<% control LatestNews %>
   <div class="case_news">
    <h2>$MetaTitle</h2>
    $MetaDescription
    $Read_more
   </div>
<% end_control %>

SS cannot access the $Read_more variable now (since it's linked to the Homepage).

If I place $Read_more _outside_ of the control block , it will work.

Anyone knows how i can access the variable from within the control ?

Thanks !

Avatar
Andy

230 Posts

24 September 2007 at 9:59am

$Link will do what you want, you don't need to create $Read_more.

Avatar
Fuzz10

Community Member, 787 Posts

24 September 2007 at 8:53pm

Thanks for your reply.

$Link produces a correct hyperlink to the item, but that is not my problem. I can't seem to figure out how to switch languages. "Read more" should read "lees meer" in Dutch (so the $Read_more string only contains text , no URL or anything.

Avatar
Andy

230 Posts

25 September 2007 at 10:01am

Oh, I get ya, sorry! Try $Parent.Read_more

Avatar
Fuzz10

Community Member, 787 Posts

25 September 2007 at 6:59pm

Thanks, but nope. Can't seem to get to that variable (or to a function defined in the homepage-controller).

Avatar
Alex S

Community Member, 30 Posts

9 September 2008 at 3:59am

Having the same issue, no joy so far...

Avatar
Fuzz10

Community Member, 787 Posts

9 September 2008 at 7:22pm

Alex :

try :
$Top.variable