Welcome Guest, Not a member yet? Register   Sign In
passing data from view to controller function?
#11

[eluser]Bhavani Shekhawat[/eluser]
Is there any way that I can do all such processing inside a controller and pass it to the view?
#12

[eluser]pickupman[/eluser]
That is what you are already doing now. That's kind of the point with MVC/CI. Controllers receives request, gets data from Model, processes data, render in a View.
#13

[eluser]Bhavani Shekhawat[/eluser]
say for example I write following in my view:

anchor('site/click/'.$r->ArtifactID, $r->ArtifactID);

and following in my controller:

function click_something($link){} //

I see that ArtifactID is not being passed at all inside my function. When I am trying to echo it, it returns nothing. Any thoughts to this?
#14

[eluser]pickupman[/eluser]
Are you using routing? If so, you need to use $this->uri->rsegment(3);

What do you get with:
Code:
function click_artifact($link){
echo $this->uri->uri_string();
}

//VS
function click_artifact(){
echo $this->uri->string();
#15

[eluser]Bhavani Shekhawat[/eluser]
I get missing argument 1 for click_artifact when I pass $link
#16

[eluser]pickupman[/eluser]
Oops...probably should have used
Code:
function click_artifact($link = FALSE){
  echo $this->uri->uri_string();
}

The second should have worked though. Also, check /application/config/config.php, and try another setting under $config['uri_protocol'] = "AUTO"; changed to a different setting as shown and try again.




Theme © iAndrew 2016 - Forum software by © MyBB