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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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

Hello world module


Go to End


5 Posts   1404 Views

Avatar
simples

Community Member, 77 Posts

2 August 2012 at 2:59am

Edited: 02/08/2012 3:31am

Hi,

I would like to find guidance on how to create a very basic Silverstripe module. I would like to start with a module which involves no CMS interface. This will keep things simple and I am hoping that this will allow me to learn how files are invoked into the process when a web page is browsed. I am just looking for something which outlines what must be in place for certain things to happen such as a file being accessed. I am not looking for a detailed explanation.

When I googled "how to" "siverstripe module" the only relevant result I got was a forum where the following was posted on 4th May 2011 with no reply.

How can I make my own Silverstripe module?

I've been looking around for a solution all day. I just can't find a good tutorial on how to make my own Silverstripe module.

The only one I found so far (http://doc.silverstripe.org/old/priv...nt_environment) does not seem to work with the latest version of Silverstripe.

If anyone can help me out, please let me know.

Thanks in advance.

Both the complete guide book by Schommer and the more recent themes book by Krenn explain module creation by adapting a pre-existing complicated module which is of very little help for the purposes of understanding the basic mechanics of what is required.

Ultimately what I would like to do is to incorporate a simple slideshow on the homepage of my site. I would like this module to be lean and mean so I want it stripped down to the bare essentials. I do not appear to be able to do this by adapting an existing module because currently, whenever I attempt to do this, 95% of the code in the module is gibberish to me.

In view of this, I thought I would try to build my own Slideshow module in 3 steps as follows.

1. Make a Helloworld module with no CMS interface with a style sheet.
2. Make a Slideshow module by adding some markup and jQuery.
3. Add a CMS interface.

I am currently stuck on Step 1 because when I browse the page where I have included the Helloworld module, it appears that the php file which contains the controller class and reference to the style sheet is not being accessed. I get this impression because the text is not being styled. Also when I place a PHP exit command (exit;) at the top of the class file, content on the page below the line which includes the module is still being sent to the screen.

I have read through and played around with the code in the Tutorials 1 and 2 in the Silverstripe documentation twice and the penny still has not dropped as to why the class file is not being accessed. This is assuming that my check for access was valid.

Am I missing something obvious?

Thanks.

PS. Something else which would be useful, and which I have not found, are basic tips (not so much what facilities are available but basic things to do) when things don't work. I know that this is something which Silverstripe may not be able to advise on because it is too broad, but perhaps what I have done above to check access to the class file is not valid. I have experience with troubleshooting procedural code but not object code.

PPS. The attached zip file contains a complete copy of the module folder, a themes folder which shows the location and content of the template file which invokes the module (all other files have been stripped out of this folder), and a file which shows the HTML source code sent to the browser.

Attached Files
Avatar
simples

Community Member, 77 Posts

2 August 2012 at 3:20am

Edited: 02/08/2012 3:21am

The following post is from DesignerX.com.au posted on 2 August 2012 at 12:25am. I accidentally removed this when I rashly deleting my first post. (This removed the complete topic including posts from other people) Sorry DesignerX.com.au.

Hi:
I have read most of your post .. its pretty long post BTW ;)

-To start, there There is alot of info on the forums + http://doc.silverstripe.org ... if you scroll down the page to where you need to create a new page type.. this is the 1st step to making a module ;)
-The best is to start making a basic Module that uses the CMS (All my work so far rely on the CMS )
- You need to read more about how the SS work & how it detect the Modules & themes.

I am very active on the IRC http://irc.silverstripe.org/ so feel free to ask me anything , I will do my best to help.

Now, I am working with SS3.0.1 & nearly done making my Gallery Module & working on few others . If you like, we could team up & few other modules done ? Let me know what you plan to do & if you got free time .

GL

Avatar
simples

Community Member, 77 Posts

2 August 2012 at 3:21am

Hi GL,

Thank you for the pointer to the online documentation. As you may have gathered I have concentrated my time on the tutorials in Level 1.

Thanks.

Avatar
simples

Community Member, 77 Posts

2 August 2012 at 3:22am

The following post is from DesignerX.com.au posted on 2 August 2012 at 12:56am. I accidentally removed this when I rashly deleting my first post. (This removed the complete topic including posts from other people) Sorry again DesignerX.com.au.

No problem..
What SS version are you working with ? is it SS3 or SS2.4.X ? Some of the docs are still related to SS2.4.X so make sure that you check which SS Version the docs are for ;)

Avatar
romice

Community Member, 1 Post

8 February 2013 at 2:24am

could you explain step by step how we should use your zip?.

I am in the same point than you in the beginning, I would like to have a super simple tutorial to make a simple hello world and then start building the site.
If I download your zip what should I do

Thanks in advance