Jump to content

calling class help needed.


spires

Recommended Posts

Hi

 

How do I turn this:

if($LCname=='Business_solutions'){
 $newChild  = Business_solutions::find_by_id(1);
}

 

In to something like this:

$newChild  = $LCname::find_by_id(1);

 

 

I'm calling lots of class's, and want to make it more dynamic.

The 2nd example would be perfect, but that does not work.

 

Is there an alternative?

 

Thanks :)

Link to comment
Share on other sites

Hi, Thanks for your help.

 

I've not come across that before.

 

I'm trying:

if (in_array($LCname, array("Business_solutions_cat"))) { // for security
    $newChild = call_user_func($LCname . "::find_by_id", 1);
foreach($newChild as $newChilds){
	echo $newChilds->id;
}
}

 

but nothing is echoing. Am I missing some code?

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.