Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Showing all files of a folder as links. Noob need help :)

Go to End

9 Posts   2074 Views


Community Member, 5 Posts

19 July 2012 at 8:02am

Hello everybody,
i created a Homepage with SS but i need some help:
How can a page create links to files of a folder automatically? So i dont have to create all links by hand. Is this possible?
I am quit noobish with php and html. So if it must done with this, i need a detailed description. Is there a module for such things?
Thx for help.


Forum Moderator, 1899 Posts

19 July 2012 at 11:12pm

Hi LaDDat,

Welcome to the Forums!

I'm going to give you the dreaded "please try the tutorials first" message here... there is far too much to explain without a base of understanding from you... after you have done the tutorials even if you don't then know how to do this, you'll have an idea and then I'd help you out. I think after you've done the tutorials, you'll know how to do this...


Community Member, 5 Posts

20 July 2012 at 3:25am

Edited: 21/07/2012 1:51am

Thx 4 the answer,
but where can i find good tutorials? I was looking for it, but didnt find anything. Was i blind?


Forum Moderator, 1899 Posts

20 July 2012 at 3:29am

Help -> Documentation -> Tutorials -->

Google works failry well too...


Community Member, 5 Posts

22 July 2012 at 2:09am

Edited: 22/07/2012 3:23am

Hello again,
i worked through the tutorials. But i need still help. I have little overview now about the structure of SS.
For my project i created a new pagetype ("datapage.php"). I am guessing that i must use the content controller to show all files in an uploaded folder. But i need help to create such a "datapage.php"-File. Can neone send me an example?


Forum Moderator, 1899 Posts

22 July 2012 at 6:01am

Is not showing you how to a) make a new page, b) create a template that iterates over databobject/datalists?

That is the basic - the only small part then is reading from a folder.

You will never need to modify any silverstirpe cms/framework files... only add a new page and template... if the second template didn't explain how to add a new page / template - I'm going to struggle doing a better job of explaining... maybe you could post the "code in progress"?


Community Member, 81 Posts

23 July 2012 at 8:16am


Community Member, 5 Posts

23 July 2012 at 10:53am

Edited: 24/07/2012 3:28am

Hi again,
thx for the help so far, but...
i really have problems understanding the tutorial since english is not my native.
could u pls post an existing example or mb just a step by step discription.

here is my php file wich i created so far:
class dataPage extends Page {

public static $db = array(
'SubTitle' => 'Varchar(255)',
function getCMSFields() {
$fields = parent::getCMSFields();

$fields->addFieldToTab('Root.Content.Main', new TextField('SubTitle'), 'Content');
return $fields;
function getData() {
$folder = DataObject::get_one("Folder", "Filename = 'assets/upload/10.Klasse/Alkohle'");
$folder = DataObject::get_one("Folder", "Filename = 'assets/upload/10.Klasse/Alkohle'");
return $folder;
class dataPage_Controller extends ContentController {

* An array of actions that can be accessed via a request. Each array element should be an action name, and the
* permissions or conditions required to allow the user to access it.
* <code>
* array (
* 'action', // anyone can access this action
* 'action' => true, // same as above
* 'action' => 'ADMIN', // you must have ADMIN permissions to access this action
* 'action' => '->checkAction' // you can only access this action if $this->checkAction() returns true
* );
* </code>
* @var array
public static $allowed_actions = array (

public function init() {

// Note: you should use SS template require tags inside your templates
// instead of putting Requirements calls here. However these are
// included so that our older themes still work


Well i am sorry that i dont understand it better.

Go to Top