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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

A few (basic) questions on building a module


Go to End


945 Views

Avatar
Mad_Clog

Community Member, 78 Posts

18 March 2009 at 8:51pm

Edited: 19/03/2009 4:05am

Hi,

I made a News module (to get to know SilverStripe better) which is largely based on the Article tutorial.
Few things I'm stuck at and would appreciate some help with:

I've added pagination to the module, however the urls of the pagination pages are in the form off /news/?start=5
How would one go about transforming those urls into something like /news/5/.
On IRC someone mentioned $url_handlers, but i can't seem to figure out how this works, nor do i know if this is the proper approach.

All the module files are located in a folder called "News" which is located in the site's root.
This way I can easily implement the module on various sites.
However if i would want to extend the base functionality (say add a field, or change a field's type, make a field mandatory, etc etc), how would this be done.
Normally you would extend a class, but then wouldn't I end up with a "NewsArticle" page type AND a "CustNewsArticle" page type?

Lastly, how do you make a field obligated in the backend?
For example with the News module i added a PublishDate field on top of the "Page"'s field, now i would like that field to always to be filled in.

Any help would be appreciated here.
Thanks in advance!

Kind regards,
Geert