ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm not very good with php but I'm trying to modify a cpgnuke module. I'm writing a new function that looks like this:
Code:
function drawbox($title, $content, $boxid, $btn[0], $btn[1] ) { code in here }
However, because of the array stuff, I get this error:
Code:
Parse error: parse error, expecting `')'' in file.php on line xxx
When I call the function, I want to put each array element in as an argument (there will be more than just the two elements of the array). I need to use arrays because of what I do inside the function.
I've tried looking at the online php manuals, but I don't really know what I'm looking for.
Is there no way to put an array in the declaration? What I plan to do is put constants (numbers/strings) in when I call the function, but then have the function use those as parts of an array. I guess I could do this:
PHP Code:
$btn[0] = $btn1 $btn[1] = $btn2
for all the elements I want to put into the array, then manipulate the $btn[] array. I will try it to see if it works. It that the only way to do it?
What the function is doing is making up to three javascript anchors in a box. I want to do a 2d array where one column is the anchor text (<a>textthatgoeshere</a>)and the other column is an argument for the javascript function. I'm going to do a while loop so that anchors are created while the anchor text is not 0. That way I can use the function to make 1, 2 or 3 anchors (or more if I make a bigger array and have more function arguments). I figure the easiest way to do this is with an array.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.