Welcome Guest, Not a member yet? Register   Sign In
Creating my library, using its class, passing it values and retrieving them
#4

[eluser]alvaroeesti[/eluser]
@Insite FX

thanks, indeed that should be the return command from the Library

but I am calling the library from the controller and that is where I want to return the values so that i can pass them together with the rest (first name etc that were at the controller obtained from a User form)

so as you can see my idea is: from the controller I get the data a user fills in the Form. That is fine. However, before I pass the password to the Model, I want to send it to the library for hashing. So once I get the salt and the hashed password (both calculated in the library) I send them to the controller and from here, like I said, to the model

Basically what I have pending now is how to retrieve these return array from the Library at the Controller in such a way that I can have it suitable for forwarding it to the Model.


This is my calling code to the Library where I pass it the password then you wrote the return array from the Library. Alright, and where do I retrieve, or how, at the controller, this data array returned by the library ?

Code:
extract($_POST);
$params = array('pass' => 'pass');
$this->load->library('myblowfish', $params);

something like this, I suppose

Code:
$data = $this->load->library('myblowfish', $params);

And another question, is that the userguide says that you need to create a constructor in the class of the library if you are passing it arguments (from the controller). So I did, but, what do you place in the constructor?

Code:
public function __construct($pass)
  {
   // Do something with $params
  }


This below is not passing any value to the class in the Library
Code:
$result = $this->load->library('myblowfish', $pass);

And the beginning of the library is:

Code:
class Myblowfish {
  
  public function __construct()
  {
   print "la pass es $pass";
  }

     public function hashit($pass)
     {

I finally got it


Messages In This Thread
Creating my library, using its class, passing it values and retrieving them - by El Forum - 08-09-2012, 10:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB