grgcnnr

https://stackoverflow.com/questions/48777375/how-to-save-a-gd-created-image-to-an-object-in-silverstripe-4 I am working on a project in Silverstripe 4. On page save/ publish I want to create a "MetaImage" which is made up of random tiles images associated with the page.

The MetaImage is created by GD - I'm then trying to save it into the ORM. Here's some example code:

public function onBeforeWrite() { $metaImage = imagecreatetruecolor(1200, 1200); //GD image created here imagejpeg($metaImage, 'assets/tmp/metaimage.jpeg');

$saveFolder =...

Shannon

https://stackoverflow.com/questions/48745523/looping-blog-pages-in-newsletter-silverstripe-add-on I want to loop my Blog Post in my Silverstripe newsletter themes I use this snippet in my Page controller:

function GetPageByType($class) { $pages = $class::get(); return $pages->count() ? $pages->first() : false; }

and these in my template:

    $FeaturedImage
    $Title

I loop from my menumanager module and it's work but i can't looping my Pages How can i loop from my Blog & the other pages?

Shannon

https://stackoverflow.com/questions/48744023/php-intl-extension-not-recognised-silverstripe I'm using MAMP to install SilverStripe and had to enable php_intl in the ini. After restarting MAMP multiple times, it still gives me this error:

ERROR [Emergency]: Uncaught Exception: This backend requires the php-intl extension IN POST /silverstripe/install.php Line 31 in C:\MAMP\htdocs\silverstripe\vendor\silverstripe\framework\src\i18n\Data\Intl\IntlLocales.php

I have checked all files that I could find and were related to it, but php_intl.dll is there and it's enabled in the ini.

rogyw

https://stackoverflow.com/questions/48736153/how-to-delete-file-image-from-filesystem-when-it-is-detached-from-dataobject-i For Example I have this code

class MyDataObject extends DataObject { private static $has_one = [ "MyImage" => Image::class, ]; public function getCMSFields(){ $fields = parent::getCMSFields(); $fields->addFieldsToTab('Root.Main', [ UploadField::create('MyImage'); ]); return $fields; } }

When user removes file from MyDataObject in admin

https://i.stack.imgur.com/yTf49.jpg

this...

Firesphere

https://stackoverflow.com/questions/48723149/how-to-get-put-and-delete-parameters-from-httprequest-in-silverstripe There are getVars(), postVars() and requestVars() methods in HTTPRequest. They returns parameters from GET and POST requests.

But how can I get parameters from PUT and DELETE requests?

I know that there is a 'body' property somewhere in HTTPRequest. It contains PUT params in query string or something similar. To use this property I need to parse 'body' field.

Is there a way to get these parameters with comfortable way, like for GET and POST?

dhensby

https://stackoverflow.com/questions/48711393/silverstripe-keeps-adding-style-font-size-10px I built a silverstripe website and one of my users is having an odd problem. Any time she tries to make a bulleted list it set style="font-size: 10px;".

Sometimes it's in the < li >, sometimes it's a < span style="font-size: 10px;">...< /span>, and sometimes it's both. I've watched her create a list and she's not doing anything out of the ordinary. She's using Safari on a Mac. I've tried recreating the error on Safari/Mac but I can't recreate the error. It seems like it might be specific...

dhensby

https://stackoverflow.com/questions/48704931/silverstripe-who-to-submit-form-into-formextension I use silverstripe 4.0.3

I made and extension for a Form. This is my Extension Class:

class NewsLetterFormExtension extends DataExtension { private static $allowed_actions = [ 'NewsletterForm' ];

public function NewsletterForm() { $form = Form::create( null, Function, FieldList::create( LiteralField::create('Newsletter','NewsLetter') ->addExtraClass(''), LiteralField::create('NLContent','Erfaharen sie regelmäßig...

shrike

@dhensby had to change it totally. SS3 -> SS4 seems to be quite different beast 🙂 -> New code here: https://pastebin.com/Aqcpv6G9

Show 1 attachment(s)
Pastebin  
[PHP] SilverStripe SS4 extending page - Pastebin.com

Pastebin: [PHP] SilverStripe SS4 extending page - Pastebin.com

Hide attachment content