Spica Posted October 8, 2015 Share Posted October 8, 2015 (edited) <dt><a href='./something/'>Do Something</a></dt><dd>Runs the executeSomething() function.</dd> How to pass some argument to the executeSomething() function? Edited October 9, 2015 by LostKobrakai Moved to module development Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 9, 2015 Share Posted October 9, 2015 The only way see is with a get variable or put variables in a session. Link to comment Share on other sites More sharing options...
LostKobrakai Posted October 9, 2015 Share Posted October 9, 2015 Or a hidden form on the page, that does get submitted to the target page with some post data. But that would make the data accessable/editable to users. Link to comment Share on other sites More sharing options...
Spica Posted October 9, 2015 Author Share Posted October 9, 2015 Hm. It seems to be not that easy. Mabey I better explain my target. A user gets a generatet pagelist. He is ment to create a childepage. Therefore each listed page gets a link. But title and name should be given by the system and not by the user. So I cannot use the add page routine by url. Name and title should include the parent_id (which is the one slected in the list) and userid. These I originaly wanted to pass as arguments to my executefunction. I think I cannot use a $input->get variable in that case. A $input-post variable would work, but only if I generate a lot of forms. But I would run into manipulation problems as LostKobrakai mention it is accessable/editable. Link to comment Share on other sites More sharing options...
LostKobrakai Posted October 9, 2015 Share Posted October 9, 2015 You need at least some way to identify which list item was clicked and you've only the get or post data option in this case. There's no way around that. As soon as you know that you can just create the page via the api and redirect to the page edit screen for the id of the new page. Link to comment Share on other sites More sharing options...
Spica Posted October 9, 2015 Author Share Posted October 9, 2015 Ok. No way around this. Thanks. Btw, is it possible to give e.g. title and name with page/add/… Link to comment Share on other sites More sharing options...
LostKobrakai Posted October 9, 2015 Share Posted October 9, 2015 You can, but it's really not much work to create the page on your own and not rely on any other party module. Link to comment Share on other sites More sharing options...
Spica Posted October 9, 2015 Author Share Posted October 9, 2015 Yes, I mostly are finished with it. Just wondered as I 've tried a &title=somewhat somewhen before. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 9, 2015 Share Posted October 9, 2015 What about session? Link to comment Share on other sites More sharing options...
Spica Posted October 9, 2015 Author Share Posted October 9, 2015 You mean storing the variables in the session? Same problem here: how to execute/store variable with at least the id as argument. Link to comment Share on other sites More sharing options...
gunter Posted March 3, 2016 Share Posted March 3, 2016 public function ___executeSomething() { $this->headline('This is something!'); $this->breadcrumb('../', 'Hello'); $url_parameter=wire("input")->urlSegment2; wire("input")->urlSegment2 worked for me for receiving the url data for an url like .....ModuleName/Something/UrlParameter but in my case I had problems to encode/decode my url parameter properly, because urlencode() and base64_encode() did not work properly, so if you know a function to do this, I would be happy.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now