Jump to content

Hello Process Module pass argument to function


Spica
 Share

Recommended Posts

<dt><a href='./something/'>Do Something</a></dt>
<dd>Runs the executeSomething() function.</dd>

How to pass some argument to the executeSomething() function?

Edited by LostKobrakai
Moved to module development
Link to comment
Share on other sites

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

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

  • 4 months later...
	

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...