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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Cant access $myVariable!


Go to End


12 Posts   1820 Views

Avatar
copernican

Community Member, 189 Posts

11 October 2012 at 2:08am

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

Avatar
wilsonStaff

Community Member, 143 Posts

11 October 2012 at 2:08am

Ok, many thanks!

Avatar
copernican

Community Member, 189 Posts

11 October 2012 at 2:44am

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'));
        }
}

Avatar
wilsonStaff

Community Member, 143 Posts

11 October 2012 at 3:53am

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!

Go to Top