Jump to:

794 Posts in 409 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Access to standard methods/ variable in a control command

Discuss SilverStripe Widgets.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1529 Views
  • PGiessler
    Avatar
    Community Member
    47 Posts

    Access to standard methods/ variable in a control command Link to this post

    Hi,

    I want to write a widget, which I can set different includes into my Sidebar. The php file of the widget works without any errors, but SilverStripe doesn't interpet <% include .... %>. I know, why this doesn't work. Maybe is there a chance to have access the global variable like CurrentMember in my control command.

    <% control IncludeIn %>
       
        <% include $Include %>
       
    <% end_control %>

    Best regards,

    Pascal

  • FungshuiElephant
    Avatar
    Community Member
    57 Posts

    Re: Access to standard methods/ variable in a control command Link to this post

    Write a function in your widget to output the html/text that you want.
    Call that function from within the control loop.

    Look at the HTML widget, it may do what you want. This forum contains instructions on getting it to work.

    1529 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.