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

Built string in Page_Controller


Go to End


2 Posts   1734 Views

Avatar
Karai

Community Member, 13 Posts

22 May 2009 at 7:58am

Hey,

I'm trying to set up a website that requires some unpleasant URLs and I want to rebuild them in the controller and output them that way.

// current output
send-me-more?package=$Title

Sometimes this can say pretty bad things like 'send-me-more?package=Something goes here & here' which is obviously bad, since when I pull $_GET['package'] out of the url, it stops at the &.

//desired output
$SendTitle

any ideas on how to do this?

Avatar
Willr

Forum Moderator, 5523 Posts

22 May 2009 at 1:00pm

well $Title would have to be escaped to convert the &'s to & which you could do in PHP with the url_encode() function. You can do this in the template by calling URLATT. eg $Title.URLATT with should convert the elements for the url.