Jump to:

22984 Posts in 11765 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » Cant access $myVariable!

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 622 Views
  • IOTI
    Avatar
    Community Member
    187 Posts

    Re: Cant access $myVariable! Link to this post

    Everything looks correct to me. I'll try it myself a little later today and let you know how I make out.

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Cant access $myVariable! Link to this post

    Ok, many thanks!

  • IOTI
    Avatar
    Community Member
    187 Posts

    Re: Cant access $myVariable! Link to this post

    Seems the updateCMSFields() gets called when going to admin/assets/ and since it's trying to add a new textfield to a Root.Main tabset and it doesn't exist it breaks. Try this

    public function updateCMSFields(FieldList $fields) {
    if($fields->hasTabSet('Root.Main')){
    $fields->addFieldToTab('Root.Main', new TextField('Description'));
    }
    }

  • wilsonStaff
    Avatar
    Community Member
    142 Posts

    Re: Cant access $myVariable! Link to this post

    HI IOTI, now it works like a charm. Something i will use over and over.

    Combined witht the function that alows me to select an image folder for a typical page, it generates a list of images from a folder that i can easily place into a Jquery image gallery and have to variables to use: $Description and $Client.

    Its like an image gallery module for SS3 without being one!

    <% control ImagesIDE %> <!-- generates images from selected folder into the page's CMS panel -->
    <!-- look for $Description and $Client as inserted into the FIles image panel -->
       <img src="$URL" alt="{$Description}<br /><strong>{$Client}</strong>" title="" />
    <% end_control %>

    As seen here (view of the Image File panel)

    Many thanks!

    622 Views
Page: 1 2
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.