Jump to:

5514 Posts in 1733 Topics by 1219 members

Customising the CMS

SilverStripe Forums » Customising the CMS » URL parameters: How to get 'Action'-parameter

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

Page: 1
Go to End
Author Topic: 5488 Views
  • NtM
    Avatar
    Community Member
    39 Posts

    URL parameters: How to get 'Action'-parameter Link to this post

    Hi,

    I have a problem with URL parameters.

    Here is my function in the page control:

    function getAction() {
          $URLParams = Director::URLParams();
          $Action = $URLParams['Action'];
          return $Action;
       }

    in my template I have next line: <p>Action = $getAction</p>

    My URLs are www.mysite.com/pageName1/getNews1 and www.mysite.com/pageName1/pageName2/getNews1

    I need $getAction to return value 'getNews1' in both cases.

    Right now those URLs show me a message 'Sorry, it seems you were trying to access a page that doesn't exist. Please check the spelling of the URL you were trying to access and try again.'

    I guess that CMS is trying to find a page with URl pageName1/getNews1 or pageName1/pageName2/getNews1.

    It doesn't understand that 'getNews1' - is not a page, but it is a parameter 'action'

    Please help!

  • wainui
    Avatar
    Community Member
    56 Posts

    Re: URL parameters: How to get 'Action'-parameter Link to this post

    any luck? having a similiar problem..
    wondering if I need to add something to director?

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: URL parameters: How to get 'Action'-parameter Link to this post

    A my example:

    function order($request) {
    print_r($request);
    echo Director::absoluteBaseURL();
    echo "Order ID " . $request->param('ID');
    $Ordine=CheckPay_Controller::save_order($request->param('ID'));
    echo "Ordine Inserito : ";
    print_r($Ordine);
    }

    with print_r and echo you can read value.

    And link checkpay/order/24/demovalue?flush=1

    5488 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.