silverstripe

SilverStripe 3 - Options for <% loop %>

白昼怎懂夜的黑 提交于 2019-12-06 05:02:59
问题 Is there a list of all the options I can add to a loop? I don't know if options is the right name for it. I mean these <% loop Dataobject.Reverse %> <% loop Dataobject.Limit() %> Can someone tell me everything that's possible here? And what the correct name for it is? 回答1: there is an error in your question, it is <% loop $DataList.xxx %> or <% loop $ArrayList.xxx %> (see, you are looping a list of DataObjects) well, loop is basically just a foreach loop so, for example: <% loop $DataList

silverstripe - adding styles to 'styles' drop down menu on editor

蹲街弑〆低调 提交于 2019-12-06 03:54:03
问题 from the question above, I thought it would be relatively easy but i can not find any documentation on on how to add styles to the 'styles' drop down menu. can anyone push me in the right direction? 回答1: The styles dropdown is automatically populated based on classes found in your theme's typography.css file. To add classes, just ensure that they are defined there. Alternatively, if you want to give the classes friendlier names or to remove some classes from the list, you can explicitly

Silverstripe DataObject - drag and drop ordering

…衆ロ難τιáo~ 提交于 2019-12-06 03:27:43
Silverstripe DataObject - I want to add drag and drop ordering to a current Class that extends dataobject like what exists for pages. So when dropped it updates an OrderBy field for all the dataobjects in that view. I created the class and can freely edit one item at a time, but a simple drag and drop ordering would make it so much easier but I can not see any such extensions currently on Dataobjects only on Pages. In SilverStripe 3.1 there are a few excellent modules that give you this sort of functionality. Two of these modules are SortableGridField and GridFieldExtensions . To get this

How to add Custom button and its functionality in Admin Silverstripe?

末鹿安然 提交于 2019-12-05 06:42:23
How to add Custom button and its functionality in Admin Silverstripe? Please tell me solution. Custom Button add only in one menu. Like @wmk mentioned in the comments, you can just take the framework code for GridFieldPrintButton as a base and go from there. SilverStripe also have a basic tutorial for creating a custom ActionProvider . Rather than rehash the tutorial here, I will provide you a very basic custom action provider that you can copy and extend to do what you need. While you don't note the exact result you are wanting from the button, I will provide just a very generic class. This

How to pass custom data to a template

别来无恙 提交于 2019-12-05 00:19:02
问题 I am new to OOP frameworks in general and Silverstripe in particular. I'm sure I'm missing something vital! I am currently trying to create a twitter feed for my main page. In my Page_controller I have: public function getTwitterFeed() { ... } ...which gets a set of tweets. I can format this data any way I like so the structure of the data and the function should be irrelevant. In the Silverstripe tutorials they give the following example: public function LatestNews($num=5) { $holder =

display titles from many_many relation in GridField - Silverstripe

冷暖自知 提交于 2019-12-04 21:01:06
How can I display the titles from a many_many relation in a GridField Summary? I tried it with RelationName.Title but the result was only an empty field colymba 's answer already said most of it, but in addition you can also specify a method in $summary_fields . This allows you to display image thumbnails in a GridField or as you need it, piece together your own string from the titles of a many_many relation. class TeamMember extends DataObject { private static $db = array( 'Title' => 'Text', 'Birthday' => 'Date', ); private static $has_one = array( 'Photo' => 'Image' ); private static $has

SilverStripe 3 - Options for <% loop %>

匆匆过客 提交于 2019-12-04 11:33:47
Is there a list of all the options I can add to a loop? I don't know if options is the right name for it. I mean these <% loop Dataobject.Reverse %> <% loop Dataobject.Limit() %> Can someone tell me everything that's possible here? And what the correct name for it is? there is an error in your question, it is <% loop $DataList.xxx %> or <% loop $ArrayList.xxx %> (see, you are looping a list of DataObjects) well, loop is basically just a foreach loop so, for example: <% loop $DataList.Reverse %>$Title<% end_loop %> is kindof the same as: <?php foreach($dataList->reverse() as $item) { echo $item

default timezone error in php

我们两清 提交于 2019-12-04 05:07:10
问题 I got the following error/warning while tring to install Kohana/SilverStripe. What does it mean and What do I do for it? Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for '5.5/no DST' instead

How to translate $url_handlers?

左心房为你撑大大i 提交于 2019-12-03 20:12:11
I have a situation where I need to translate the following $url_handlers for different countries. So on an english site the URL looks like this: http://website.com/gyms/boston/group-training I need to be able to translate the "group-training" part of the URL. I have translated the rest of the site using the _t() method throughout. My current setup: class GymLocationPage_Controller extends Page_Controller { private static $allowed_actions = array( 'currentSpecials', 'sevenDayFreeTrial', 'groupTraining' ); private static $url_handlers = array( 'current-specials' => 'currentSpecials', 'trial' =>

How to pass custom data to a template

和自甴很熟 提交于 2019-12-03 16:16:10
I am new to OOP frameworks in general and Silverstripe in particular. I'm sure I'm missing something vital! I am currently trying to create a twitter feed for my main page. In my Page_controller I have: public function getTwitterFeed() { ... } ...which gets a set of tweets. I can format this data any way I like so the structure of the data and the function should be irrelevant. In the Silverstripe tutorials they give the following example: public function LatestNews($num=5) { $holder = NewsHolder::get()->First(); return ($holder) ? News::get()->filter('ParentID', $holder->ID)->sort('Created',