21293 Posts in 5733 Topics by 2602 members
General Questions
SilverStripe Forums » General Questions » Showing all files of a folder as links. Noob need help :)
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 509 Views |
-
Showing all files of a folder as links. Noob need help :)

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. -
Re: Showing all files of a folder as links. Noob need help :)

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...
-
Re: Showing all files of a folder as links. Noob need help :)

20 July 2012 at 3:25am Last edited: 21 July 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? -
Re: Showing all files of a folder as links. Noob need help :)

20 July 2012 at 3:29am
Help -> Documentation -> Tutorials --> http://doc.silverstripe.org/framework/en/tutorials
Google works failry well too... http://lmgtfy.com/?q=silverstripe+tutorials&l=1
-
Re: Showing all files of a folder as links. Noob need help :)

22 July 2012 at 2:09am Last edited: 22 July 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?
Greetings -
Re: Showing all files of a folder as links. Noob need help :)

22 July 2012 at 6:01am
Is http://doc.silverstripe.org/framework/en/tutorials/2-extending-a-basic-site 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"?
-
Re: Showing all files of a folder as links. Noob need help :)

23 July 2012 at 8:16am
hi there
have a look here:
http://www.silverstripe.org/data-model-questions/show/12951#post315243lukas
-
Re: Showing all files of a folder as links. Noob need help :)

23 July 2012 at 10:53am Last edited: 24 July 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:
<?php
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() {
parent::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
Requirements::themedCSS('reset');
Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
}}
Well i am sorry that i dont understand it better.
| 509 Views | ||
| Go to Top | Next > |



