PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and then catch them in another file and output all of them...
Detailed explination
I use OOP and as i call the OOP function i should get an array with links in it
then i should output those links so that the user can see them...
It might be better to put the implode() inside the getLinks() method. If you add links individually then keeping them in an array makes sense. But if you always want a string containing the links, then put that functionality inside getLinks().
If you understand the problem then please tell me what to do to make it go away.
"Im sorry if I don´t make any sense" Im extreamly tired and over worked at the moment...
//Thanks in advance
//Thomas
Last edited by Goofan on Sat May 15, 2010 6:29 pm, edited 1 time in total.
I think you're mistaking the $link variable with the $links variable. If you want to call the function inside you Index instance, then new need to refer to it with the right variable.
<?php
class Menu {
protected $links;
public function __construct() {
$this->links = array(
"<a href='Index.php?Action=Overview'>Overview</a>",
"<a href='Index.php'>Link Two</a>",
"<a href='Index.php'>Link Three</a>",
);
}
public function GetLinks() {
return $this->links;
}
public function GetLinksString($separator) {
return implode($separator, $this->links);
}
}
A __construct() function isn't required in class, though it's good practice. So long as you call $link->MenuUserNormal() you should still get the desired effect.
Someone got an ide? I dont think youre code works like it should considering the changes i made to the original code... "EDITED CODE post" Making the code complete...
Relook at it please. =)
//Thanks in advance
//Thomas
Last edited by Goofan on Mon May 17, 2010 2:14 pm, edited 1 time in total.