silverstripe

“There is an error” when clicking on some Silverstripe admin pages

∥☆過路亽.° 提交于 2020-01-07 07:12:11
问题 I'm trying to fix a problem with some Silverstripe admin pages. Everytime when I click on Cart or Example product page, the message - "There is an error" pops up, and the page wouldn't show. Please see the attached image. As you can see page Cart and example product's icons are different from the rest. I didn't write the code myself and I've never experienced this before, so any suggestion on where I should start to tackle the problem would be appreciated. I can copy some code here if you can

SilverStripe 3.1+ Dynamically creating page redirects

空扰寡人 提交于 2020-01-07 02:01:13
问题 I have a page type 'ProductPage', it has tabs that are navigated to like so: /ProductPageUrlSegment/?tab=video /ProductPageUrlSegment/?tab=audio /ProductPageUrlSegment/?tab=photos I'd like for redirects to be created when each new product page is created so that if you navigated /ProductPageUrlSegment/video it goes to /ProductPageUrlSegment/?tab=video and the same for all tabs. I'm not clear if I should be using Routing https://docs.silverstripe.org/en/3.3/developer_guides/controllers/routing

silverstripe dopublish function for ModelAdmin managed Pages

↘锁芯ラ 提交于 2020-01-06 19:34:06
问题 in the silverstripe backend I´m managing certain PageTypes via a ModelAdmin. That works fine so far, the only thing i can´t figure out is how to make a Page being "Published" when saving it. Thats my code: class ProjectPage extends Page { public function onAfterWrite() { $this->doPublish(); parent::onAfterWrite(); } } At the moment I can still see the ModelAdmin-created Pages in the Sitetree and I can see they are in Draft Mode. If I use the code above I get this error: Maximum execution time

Silverstripe 3.1 - many_many relation - unlink and delete entries

丶灬走出姿态 提交于 2020-01-06 15:02:12
问题 Normally there's only a unlink function for the entries in a many_many relation grid field. But that's messy. How can I also add an delete option? 回答1: you can use: $config->addComponent(new GridFieldDeleteAction(false)); which will add a delete button. The false argument specify that it is a delete button not unlink . $config is your GridFieldConfig instance. 来源: https://stackoverflow.com/questions/19524951/silverstripe-3-1-many-many-relation-unlink-and-delete-entries

Silverstripe DataObjects as Pages Part 2 tutorial - Admin Checkbox

妖精的绣舞 提交于 2020-01-06 08:38:21
问题 I'm using the code from DataObjects as Pages 2, so you can choose one to many categories for each product you created under Product tab in admin. My question is how can I show the parental pages'(it is called ProductsList.php) titles for the categories? Please see the image for details Or here is the explain: Because all my Category pages are under one or more parents, and some Categories pages are repeated on the site eg Toyota and Honda. I'd like the parents page's titles to show eg Sale

How do I set the colour of a custom tag in html-mode

混江龙づ霸主 提交于 2020-01-06 05:37:07
问题 Trying to get a mode to work with silverstipe templates. How do I set the background of the <% %> tag to be a darker color? 回答1: You can customize any face using the customization system, but the trick is to know which face you have to edit to get the look that you want. There is a shortcut you can use in this case: position the point over the text in question and run M-x describe-face. This asks for a face name, but the default if you leave the input blank is the face used by the text at

I Can Not Remove The Default Drop Down of a $has_one in Silverstripe

一世执手 提交于 2020-01-05 07:43:34
问题 I have tried: removeFieldFromTab removeByName replaceField But the field persists. use SilverStripe\ORM\DataObject; use //..... class Product extends DataObject { private static $db = [ 'ProductName'=>'Varchar', 'TagLine'=>'Text', 'GeneralDescription'=>'HTMLText' ]; private static $has_one = [ 'SplashImage'=>Image::Class, 'ProductCategory'=>ProductCategory::Class ]; private static $has_many = [ 'ProductImage'=>Image::Class, 'Features'=>'Feature' ]; private static $owns = [ 'SplashImage',

SilverStripe custom FormField_Holder

Deadly 提交于 2020-01-05 03:52:07
问题 I've created a simple contact form within the page controller. For the front-end view of this contact form, I wish to use a customised FormField_Holder rather than the default one. I've created a FormField_Holder.ss within themes/templates/Includes . How do I apply this template to my $ContactForm ? I've tried this already: public function ContactForm() { $form = Form::create( ... ); foreach($form->Fields() as $field) { $field->setFieldHolderTemplate('myHolder'); } return $form; } 回答1: I

SilverStripe: Rendering a userforms page type in a template loop

喜欢而已 提交于 2020-01-02 18:04:30
问题 Using SilverStripe 3.1 I have laid out a FrontPage page type that loops through its children to produce a big tall scrolling page. It has all kinds of different page types in it and I access their templates by creating their controllers on the fly by adding on to the Page class: class Page extends SiteTree { ..... function RenderAsChild($templateName = null) { if(!$templateName) $templateName = $this->ClassName; if(!$this->pageController){ $class = $this->ClassName . "_Controller"; $this-

display titles from many_many relation in GridField - Silverstripe

狂风中的少年 提交于 2020-01-01 19:53:10
问题 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 回答1: 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' =>