silverstripe

SilverStripe 3.1 ListboxField save array to database

假如想象 提交于 2021-02-10 12:38:39
问题 I want to know how to correctly save values selected with a ListboxField. new ListboxField( $name = "Categorie", $title = "Catégorie(s)", Categories::get()->map('ID','Title'), $value = 1, $size = 4, $multiple = true ); In my example, I can save more than one category to a $db field. I am using: private static $db = array( 'Categorie' => 'Varchar' ); It works, but when I'm trying to get back categories names into a template it dosen't work at all. The data stored for example is "1,4,9" . Is

How to save multiple values entered into ListBoxField and loop through values?

筅森魡賤 提交于 2020-12-31 06:01:25
问题 I want to be able to associate team members to a project using the ListBoxField . I have a ProjectHolder which has Project pages as it's children. I also have a TeamHolder which has TeamPage 's as its children. I want to be able to save multiple team members in the ListBoxField and then loop through them on a Project page. I also want to be able to link to the team members pages. e.g <% loop $TeamMemberNames %> <a href="$Link">$Name</a> <% end_loop %> My Current code: TeamPage.php class

How to save multiple values entered into ListBoxField and loop through values?

我只是一个虾纸丫 提交于 2020-12-31 05:59:07
问题 I want to be able to associate team members to a project using the ListBoxField . I have a ProjectHolder which has Project pages as it's children. I also have a TeamHolder which has TeamPage 's as its children. I want to be able to save multiple team members in the ListBoxField and then loop through them on a Project page. I also want to be able to link to the team members pages. e.g <% loop $TeamMemberNames %> <a href="$Link">$Name</a> <% end_loop %> My Current code: TeamPage.php class

How to add javascript to all pages in silverstripe cms via a module?

六月ゝ 毕业季﹏ 提交于 2020-07-10 10:25:30
问题 I am trying to create a module for silverstripe. I am going through https://docs.silverstripe.org/en/4/developer_guides/templates/requirements/#requirements to understand how to add javascript and css files to the front end pages. What I am not able to figure out is how to add a javascript file to all cms pages when the user installs my module. Is there a class I can extend and specify there? Or can it be done using the config somehow? 回答1: Create a class that subclasses SilverStripe\Core

SilverStripe submit HTML form through Ajax

房东的猫 提交于 2020-05-15 08:35:09
问题 I want to pass data from a simple HTML form to a controller through Ajax, then process the data and return a response back. At the moment I have the following: HomePage.ss <form method="POST" class="form-horizontal submit-form" onsubmit="return checkform(this);"> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="name">Name</label> <div class="col-md-8"> <input id="name" name="name" type="text" placeholder="insert full Name" class="form-control input-md"

SilverStripe submit HTML form through Ajax

旧时模样 提交于 2020-05-15 08:35:05
问题 I want to pass data from a simple HTML form to a controller through Ajax, then process the data and return a response back. At the moment I have the following: HomePage.ss <form method="POST" class="form-horizontal submit-form" onsubmit="return checkform(this);"> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="name">Name</label> <div class="col-md-8"> <input id="name" name="name" type="text" placeholder="insert full Name" class="form-control input-md"

SilverStripe 4 - Blank page on logging out

喜欢而已 提交于 2020-01-14 04:04:29
问题 As I stated here, I would allow pre-generated users to log out from a SilverStripe 4 website front-end page, by using the default from. Logging out because log in works. The problem is that if a logged generic user tries to log out by clicking on a link like Security/logout (as well as Security/logout?BackURL=home/ ), it being redirected to a blank page (just with header/footer visible, as the default Page.ss is implemented). Apparently the controller doesn't work or similar, because URL

Silverstripe 3.1.5 - Upload Error SyntaxError: Unexpected token <

我的未来我决定 提交于 2020-01-11 06:23:28
问题 I need to Upload .svg files. To do that I added 'svg' to my config.yml, to the allowed extensions on upload field an to the .htacces in assets/. Also all my assets directories have CHMOD 777. The File gets uploaded but not attached. Instead of that I receive this error in my upload field SyntaxError: Unexpected token < File: allowed_extensions: - svg Image: allowed_extensions: - svg $logo->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif', 'svg')); Deny from all <FilesMatch "\.(?i:html

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

*爱你&永不变心* 提交于 2020-01-07 07:13:12
问题 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