Welcome Guest, Not a member yet? Register   Sign In
Problem passing data to my library from controller to run common functions
#2

[eluser]MasterHernan[/eluser]
Your banner code:
Code:
class Banner {

function select($params)
{

  $bn = $this->$bannernumber;

  // Code to choose img, set id for CSS, set link

  }

}

Fixed code:
Code:
class Banner {

function select($params)
{

  $bn = $params['bannernumber'];

  // Code to choose img, set id for CSS, set link

  }

}

You were sending the array to the function and the function was receiving it as a private function variable, the object variable that you are looking for was not defined. You don't need to pass the $params again if you grab them in the __construct function and save it to the object since you are submitting it when you call the library.

For more information check out:
http://ellislab.com/codeigniter/user-gui...aries.html
#Passing Parameters When Initializing Your Class


Messages In This Thread
Problem passing data to my library from controller to run common functions - by El Forum - 09-27-2012, 09:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB