Jump to:

23376 Posts in 18214 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Newbie Questions

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

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

Page: 1
Go to End
Author Topic: 861 Views
  • matthewjumps
    Avatar
    Community Member
    21 Posts

    Newbie Questions Link to this post

    Hi all, Im pretty new to SS but Im digging it so far... a couple of things are confusing me and I cant seem to find any documentation on them.

    Firstly, $URLSegment is fine for top level pages, but if a template in a subpage calls $URLSegment then I only get the last chunk of the URL. Eg on /articles/article-01 it returns /article-01. What if I want to get the entire thing? $ExternalURL and $LegacyURL dont seem to work, and I cant seem to find any other page controls to do what I need.

    Second, can I make certain fields editable only by certain users? If I create a data object with, say, a "PreloadBeforeShow" and a "PreloadWithMain" fields defined in $db, and add those fields to a CMS tab, how can I control which users can see those fields in the admin interface?

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Newbie Questions Link to this post

    * You should use $Link to get the full link to a page.

    * Editing is normally done on a object basis rather than per cms field. If you want to do it on a per field basis then you will have to it with custom code. Eg if you have a member in the group 'Admin' and a member in the group 'Content Editors' and you want to make something admin only you can check for the group using inGroup('Admin') (or you should step up permission codes http://doc.silverstripe.org/permission)

    For example using groups..

    $fields = ...

    $member = Member::currentUser();
    if($member->inGroup('Admin') {
    // add an admin only field
    }
    ..

  • matthewjumps
    Avatar
    Community Member
    21 Posts

    Re: Newbie Questions Link to this post

    Thanks! Both of those answers were perfect

    861 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.