Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Re: How does Silverstripe work?

$
0
0

Does this mean that if a template in a published module contains a control structure, which for example retrieves data, the person installing that module will need to add code outside the module, such as in a mysite code class, before those control structures will work?

Absolutely not, as you point out that would be shame (and useless). Modules either provide custom Page types for the user (see Userforms) or bolt onto core class through DataExtension. A simple example would be

<?php

class MyPageExtension extends DataExtension {

public getSomeNewData() {
return Page::get();
}

Once adding that extension to your Page (through the Config system) your Pages could now do <% loop SomeNewData %>

The best way to learn is to browse through some of the existing modules and take a look at the example code from the books.


Posted to: How does Silverstripe work? | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles