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

Query Data from a custom Table


Go to End


30 Posts   7889 Views

Avatar
Breastfed

Community Member, 44 Posts

16 March 2009 at 3:57am

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!

Avatar
Carbon Crayon

Community Member, 598 Posts

16 March 2009 at 4:30am

Edited: 16/03/2009 4:30am

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}");

}

Avatar
Breastfed

Community Member, 44 Posts

16 March 2009 at 4:39am

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

:/

Avatar
Carbon Crayon

Community Member, 598 Posts

16 March 2009 at 5:17am

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.

Avatar
Breastfed

Community Member, 44 Posts

16 March 2009 at 5:26am

thanks! :)

Avatar
Carbon Crayon

Community Member, 598 Posts

16 March 2009 at 5:33am

Your welcome :)

Go to Top