Jump to:

22979 Posts in 11815 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Query Data from a custom Table

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 2 3 4
Go to End
Author Topic: 3945 Views
  • Breastfed
    Avatar
    Community Member
    44 Posts

    Re: Query Data from a custom Table Link to this post

    Ah ok.

    that was my Idea to have 1Page (Location) instead of upcoming 500

    There is another Question in the Board i wrote.
    It is related to this here, because i want to grab Data on a Detailpage.
    But the Variable shouldn't be an ID.
    It should be the name with some modiifcations.

    Maybe you have some Thoughts for me ;) ?

    Thanks Aram!

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Query Data from a custom Table Link to this post

    ok, well you can pass anything you like as long as you can use it to fetch the Submission that you want from the database.

    So for example you could use $Name and $Author by passing a link location/$Name/$Author and using a function like this:

    public function GetLocationSubmission(){

    $Params = Director::urlParams(); //This gets our URLparams
    $Name = $Params['Action']; //gets the first param
    $Author = $Params['ID']; //gets the second param

    return DataObject::get_one("LocationSubmission", "Name = {$Name} AND Author = {$Author}");

    }

  • Breastfed
    Avatar
    Community Member
    44 Posts

    Re: Query Data from a custom Table Link to this post

    ah ok and how can i replace

    "ä ö ü ß" with "ae oe ue ss" write everything lowercase and replace an Space with "_"?

    For example:
    Locationname: "Die kleine Kneipe" - should be fetched by the URL: domain.de/die_kleine_kneipe

    :/

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Query Data from a custom Table Link to this post

    have a look at the PHP docs for string functions, theres probably some stuff in there to do search and replace type stuff. I don't think sapphire/SS has anything that can help you with that.

  • Breastfed
    Avatar
    Community Member
    44 Posts

    Re: Query Data from a custom Table Link to this post

    thanks!

  • Aram
    Avatar
    Community Member
    598 Posts

    Re: Query Data from a custom Table Link to this post

    Your welcome

    3945 Views
Page: 1 2 3 4
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.