How to install and use modules in SilverStripe
Tag : php , By : Paul McKee
Date : March 29 2020, 07:55 AM
like below fixes the issue General approach of installing a module in SilverStripe: Prerequisite: As always, back up your database. Log into your site as admin. I'm always doing this first, in case any changes prohibit a log in later on (normally if you change your existing code, but logging in first never hurts). Unpack the module and put it into your installation's base folder (where sapphire, cms, mysite,... are). Make sure the folder is named correctly, this should be described in the download. If there is no specific description, leave the name as it is after unpacking. There shouldn't be a version number in the folder name. Go to http://yoursite.com/dev/build?flush=all - that will sync your database with your code. You're good to use the module...
|
SilverStripe update notifications for CMS and Framework, and modules installed
Date : March 29 2020, 07:55 AM
|
Extending SilverStripe modules extension
Date : March 29 2020, 07:55 AM
I hope this helps you . Using injector does solve the problem but have to use _config.yml as well. Here is what I did. File /mysite/extensions/MyCustomClass.php class MyCustomClass extends CustomClass {
public function customMethod() {
//do my code here
}
}
Injector:
CustomClass:
class: MyCustomClass
$object = Injector::inst()->create('CustomClass');
|
Flexible content modules in Silverstripe
Date : March 29 2020, 07:55 AM
seems to work fine Both silverstripe-blocks and silverstripe-elemental works very well in their own regard but I don't think they will achieve what you want. These modules don't really give you the power to use pre-defined templates. You can hook the templates in but the code will be massive. I not sure if there is an open source module for that yet. From your JSON code, in order to have those Sections to render something like this below; <section id="Sections">
<div id="video_text" class="section">
<iframe width="560" height="315" src="https://www.youtube.com/watch?v=asdfa" frameborder="0" allowfullscreen></iframe>
</section>
<div id="text" class="section">
<h2>Text Title</h2>
<a class='text-center btn btn-default' href="/about/">CTA button</a>
</section>
</sections>
Page.php
private static $has_many = array(
"Sections" => "BlockSection",
);
function SectionContent()
$aContent = ArrayList::create();
$oSections = $this->Sections();
if (count($oSections )) {
foreach ( $oSections as $oSection ) {
$aContent->push(ArrayData::create([
"Section" => $oSection,
"Content" => $oSection->renderWith([$oSection->ClassName, get_parent_class($oSection)]),
]));
}
}
return $aContent;
<div id="video_text_{$ID}" class="section">
<iframe width="560" height="315" src="{$URL}" frameborder="0" allowfullscreen></iframe>
</section>
<% loop $SectionContent %>
{$Content}
<% end_loop %>
|
Pointers for getting started with SilverStripe modules
Date : March 29 2020, 07:55 AM
|