silverstripe

SilverStripe 3.1 GridField file link is re-written with HTML Entities

对着背影说爱祢 提交于 2019-12-11 09:16:39
问题 I'm very new to Silverstripe (3.1). I am using it to collect applications from users. Each user uploads a file which later in the CMS somebody can download. There is a has_one relationship for the file called 'Document.' I want to link to that file inside a GridField. So after some searching I did the solution below - easy, and it works except for one problem. The link does appear inside the correct column in the GridField but it has been converted through something like HTMLSpecialChars()

SilverStripe save data to external table

烂漫一生 提交于 2019-12-11 09:13:57
问题 In SilverStripe how can I save data to an external database table, which has not been created by SilverStripe? For example: I have created a News table and want - if I add new a News item - that the same data is stored in my previous News table. 回答1: If the tables are the same you can actually just switch the database config and then use the ORM and then switch is back... $otherDB = array( "type" => 'MySQLDatabase', "server" => 'localhost', "username" => 'new_user', "password" => 'xxxx',

Set base url in configuration

江枫思渺然 提交于 2019-12-11 08:29:01
问题 How is it possible to set the base url? In the documentation of 3.1 is written: Director::setBaseURL: Use Director.alternate_base_url instead Is there any example where to put the Director.alternate_base_url? Thank you 回答1: The recommended way to do this is by updating your _config.yml , adding the following lines (remember indentations are 2 spaces): Director: alternate_base_url: '/' a full _config.yml file could look something like --- Name: mysite After: 'framework/*','cms/*' --- SSViewer:

Silverstripe subsites with independent user registrations

半腔热情 提交于 2019-12-11 07:45:13
问题 I'm using the subsites module to make a multi site system. I'd like the users logins to the sites to be independent. So if a user has registered on one site, they can't just go to another subsite and login - they have to register for that site too. In other words - registrations on each subsite is completely independent. Is this possible? 回答1: Technically it would be possible to write a DataObjectDecorator for the Member class, and add a SubsiteID to each member, and then add a filter for

SilverStripe - Simple example of session usage

老子叫甜甜 提交于 2019-12-11 07:16:29
问题 i'm trying to start with session, but until now (yes I red the docs) I absolutely don't know how to start. perhaps someone can give me a simple example. E.g. store if a checkbox is checked or not. thank you in advance 回答1: SilverStripe sessions are pretty straight forward. the class Session is just a nice wrapper around the php $_SESSION Session::set('MyCheckboxValue', 'Hello World'); to retrieve this: $value = Session::get('MyCheckboxValue'); // note this will always return something, even

Add Google Recaptcha on a SilverStripe form

╄→гoц情女王★ 提交于 2019-12-11 06:26:29
问题 I am trying to add Google Recaptcha to my custom SilverStripe form. I have generated Google public and private keys but I do not know where to put them to show a captcha on my website. Here is my current code: ContactPage class ContactPage extends Page { private static $db = array( 'TelCustomerSupport' => 'Varchar', 'TelProjectSupport' => 'Varchar', 'OfficeName' => 'Text', 'OfficeStreetAddress' => 'Text', 'OfficeAddressLocality' => 'Text', 'OfficePostalCode' => 'Varchar', 'OfficeMapLink' =>

Silverstripe: Convert twitter JSON string to Dataobject to loop though in template

六月ゝ 毕业季﹏ 提交于 2019-12-11 06:25:47
问题 I'm using the twitter API to get a timeline which I want to output through my template. I'm getting the feed like so: public static function getTwitterFeed(){ $settings = array( 'oauth_access_token' => "xxx", 'oauth_access_token_secret' => "xxx", 'consumer_key' => "xxx", 'consumer_secret' => "xxx" ); $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=xxx&count=5'; $requestMethod = 'GET'; $twitter = new TwitterAPIExchange($settings); $returnTwitter =

Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set

二次信任 提交于 2019-12-11 06:18:34
问题 I'm getting the following error: PHP Warning: Director::protocolAndHost() lacks sufficient information - HTTP_HOST not set. in /<path/to/project>/framework/control/Director.php on line 488 But, when I add print_r($_SERVER['HTTP_HOST']); to mysite/_config.php I get the appropriate url. Any ideas what this could be? It started suddenly yesterday after weeks of developing on the same host. It's only happening on my remote environment. Local works fine. I haven't made any config changes. I've

Silverstripe 3.1 - One player has many teams

跟風遠走 提交于 2019-12-11 06:15:38
问题 I'm trying to create a Team List like this. TeamHolder - for all teams. Has Teampages as children TeamPage - description and image of the team. And also an has_one relation to TeamMember(Dataobject) TeamMember - has the members. here you also should be able to define in which teams the player is. here's my code for this. But i don't know how i can make a has_many relation to my team pages, so that you can choose multiple teams for one player. has anyone a solution for this? http://www.sspaste

silverstripe / tinymce - stop automatic resize

人盡茶涼 提交于 2019-12-11 04:46:27
问题 Using Silverstripe CMS (v3.4) when I upload an image using the tinymce editor it automatically sets the width/height on the image. This causes problems such as breaking animated gifs so they don't play and also reduces the quality of static images. How do I turn this feature off completely so that no resizing is done on upload? 回答1: You can modify the insert width of the images instead of them being resized to 600px wide. mysite/_config.yml HtmlEditorField: insert_width: 1200 You can also