silverstripe

DataObjects as Pages (SSBits Tutorial) - Sivlerstripe 3

牧云@^-^@ 提交于 2019-12-13 09:55:24
问题 I tried to use this tutorial http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-2-using-model-admin-and-url-segments-to-create-a-product-catalogue/ from ssbits for my news section. I think I did everything right. But I can't save the NewsObject. This error appears Notice at line 155 of /mysite/code/DataObjects/NewsObject.php Line 155 is this $this->URLSegment = SiteTree::generateURLSegment($this->Title); But what's wrong here? Here's my whole code. Perhaps someone can help me to

SilverStripe3: Multiline comments in template

元气小坏坏 提交于 2019-12-13 06:07:51
问题 In SilverStripe 3, How can I put multiline comments in template file ? 回答1: single line comments can be done with <%-- my comment --%> (or the html way <!-- my comment --> which will be sent to the browser, but hidden not displayed.) as far as I know, there is no multiline comment in silverstripe templates. An ugly work around would be <% if false %> , like so: <% if false %> some comment text here <% end_if %> 来源: https://stackoverflow.com/questions/12739970/silverstripe3-multiline-comments

Eliminate Text Bubble Error On SilverStripe 3 Forms

时光怂恿深爱的人放手 提交于 2019-12-13 05:16:21
问题 For some reason I'm getting two different kinds of error messages on the same SS 3 form as shown in the referenced screenshot. How do I get rid of the text bubble style error message on the email field and have them all look like the error box on the name field? Screenshot: http://d.pr/i/ThmL Bob 回答1: In SilverStripe 3.0/1 it enabled the use of the HTML5 required attributes which web browsers pick up and do their own validation for (which you've seen). If you want to stop the browser

Silverstripe 3.1.x getting values from Parent

筅森魡賤 提交于 2019-12-13 04:53:11
问题 I would like to get a generic function working for getting Data in Template of a Page and if the property is not set, getting it from the Parent or Parents Parent and so on. With generic I mean independent of Relations like db, HasOne, HasMany, ManyMany. Let's say I have this for ManyMany but would like to detect if it's a Object, HasManyList or ManyManyList or a value. Is anything like this built in or how would you go about? function ManyManyUpUntilHit($ComponentName){ $Component = $this-

Define the URL of an Dataobject - Silverstripe 3.1

╄→尐↘猪︶ㄣ 提交于 2019-12-13 04:37:42
问题 How can I change the url of an dataobject? I can get the dataobject under the following url with this function. www.domain.tld/articles/art?=1234 public function ArticleByID() { $articleID = isset($_GET['art']) ? $_GET['art'] : false; return $articleID ? Articles::get()->filter(array('ShortNumber' => $articleID))->First() : false; } But what I want is for example this www.domain.tld/articles/1234 or www.domain.tld/members/member-name 回答1: You can create a show() function that you would call

Silverstripe DataObjects as Pages Part 2 tutorial- sidebar issue

安稳与你 提交于 2019-12-13 04:21:07
问题 I've been following Silverstripe DataObjects as Pages - Part 2: Using Model Admin and URL Segments to create a product catalogue tutorial on my localhost and running into a sidebar problem. When I use the same method to create a sidebar as tutorial one, an error message shows on my site [User Error] Uncaught Exception: Object->__call(): the method 'categorypages' does not exist on 'Product' This is the code I added to Product.php for sidebar to appear. //Return the Title as a menu title

Dynamically Update Manifest file based on image uploads in SilverStripe admin

巧了我就是萌 提交于 2019-12-13 04:08:03
问题 I'm new to HTML5's application cache, but am familiar with the basics of it. I'm working on a cache manifest file for a SilverStripe site that needs to be dynamically updated whenever the content manager uploads a new image. I understand that the images will be appended to the Manifest function below using a loop, but the part that I find to be a challenge is updating the date and version number every time. Would I need to have the date and version listed as variables? Or is that not possible

SilverStripe Model-Level Permissions: canCreate() doesn't work

﹥>﹥吖頭↗ 提交于 2019-12-13 02:59:29
问题 I have dataobject : class Documents extends DataObject implements PermissionProvider { private static $db = array( 'DocType' => 'Text', 'ApprovalDate' => 'Date', 'PublicationDate' => 'Date', 'DocNumber' => 'Text', 'DocTitle' => 'Text', 'KeyWords' => 'Text' ); private static $has_one = array( 'Member' => 'Member' ); ... static $api_access = true; public function canEdit($member = false) { return (Member::currentUserID() == $this->MemberID) || parent::canEdit($member); } public function

Howto hook into 'PageLoaded' observer in SilverStripe 3?

允我心安 提交于 2019-12-13 01:29:19
问题 I need to execute a jQuery function after a page loaded. The docs told me that it would be possible to hook into the 'PageLoaded' observer. So I tried it like shown there. I put this function Behaviour.register({ '#Form_ItemEditForm' : { initialize : function() { this.observeMethod('PageLoaded', this.pageLoaded); this.observeMethod('BeforeSave', this.beforeSave); this.pageLoaded(); // call pageload initially too. }, pageLoaded : function() { alert("You loaded a page"); }, beforeSave: function

Silverstripe: get var from many_many relation custom upload

瘦欲@ 提交于 2019-12-13 01:08:47
问题 I would like to know how customize this uploadfield to get from $belongs_many_many Act table. A part of the code.... <? class MultipleBlock extends DataObject { private static $db = array( 'Act' => 'Varchar', private static $many_many = array( 'MultipleBlockColumns' => 'MultipleBlockColumn' ); } class MultipleBlockColumn extends DataObject { static $belongs_many_many = array( 'MultipleBlocks' => 'MultipleBlock' ); private static $has_one = array( 'Image' => 'Image', ); $fields->addFieldToTab(