appleifreak
05 Jun 2009, 06:27 PM
Okay so I am pretty new to OOP in PHP (used to php4) and I understand that you need some $this in front of other stuff, however I don't use any functions in my function, yet it still doesn't work. Here's the code:
Library function:
function navBar($thisLink,$thatLink,$nav = array()) {
$CI =& get_instance();
$string = '';
$baseUrl = 'http://rpg.antiradiant.com/';
if ($thisLink != $thatLink) {
$string .= '<a href="'.$thatLink.'" class="navAnchor"><img width="170" height="35" src="'.$baseUrl.'media/images/UI/nav/profile/off.jpg" srcover="'.$baseUrl.'media/images/UI/nav/profile/hov.jpg" srcdown="'.$baseUrl.'media/images/UI/nav/profile/on.jpg"/></a>';
} else {
$string .= '<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="'.$thisLink.'" class="navAnchor"><img width="170" height="30" src="'.$baseUrl.'media/images/UI/nav/hangar/slct_top.jpg"/></a></td>
</tr>';
if (count($nav) > 0) {
$string .= '<tr>
<td class="navMore">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30"> </td>';
foreach ($nav as $row) {
$string .= '<td><a href="'.$row['anchor'].'">'.$row['link'].'</a></td>';
}
$string .= '<td width="30"> </td>
</tr>
</table></td>
</tr>';
}
$string .= '<tr>
<td><img width="170" height="10" src="'.$baseUrl.'media/images/UI/nav/slct_bot.jpg"/></td>
</tr>
</table>';
};
return $string;
}
controller function:
function index()
{
$this->load->view('test');
}
view file:
$navInfo = array(
1 => array(
'anchor' => 'profile',
'link' => 'Profile'
),
2 => array(
'anchor' => 'alliance',
'link' => 'Alliance'
)
);
echo $this->ui->navBar('profile','profile',$navInfo); // THIS IS LINE 13
BTW, this is built in the framwork CodeIgniter (http://codeigniter.com/) and they were of no help what so ever. The error is:
Fatal error: Call to a member function navBar() on a non-object in /nfs/c02/h07/mnt/XXXXX/domains/aPlace.antiradiant.com/html/system/application/views/test.php on line 13
Library function:
function navBar($thisLink,$thatLink,$nav = array()) {
$CI =& get_instance();
$string = '';
$baseUrl = 'http://rpg.antiradiant.com/';
if ($thisLink != $thatLink) {
$string .= '<a href="'.$thatLink.'" class="navAnchor"><img width="170" height="35" src="'.$baseUrl.'media/images/UI/nav/profile/off.jpg" srcover="'.$baseUrl.'media/images/UI/nav/profile/hov.jpg" srcdown="'.$baseUrl.'media/images/UI/nav/profile/on.jpg"/></a>';
} else {
$string .= '<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="'.$thisLink.'" class="navAnchor"><img width="170" height="30" src="'.$baseUrl.'media/images/UI/nav/hangar/slct_top.jpg"/></a></td>
</tr>';
if (count($nav) > 0) {
$string .= '<tr>
<td class="navMore">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30"> </td>';
foreach ($nav as $row) {
$string .= '<td><a href="'.$row['anchor'].'">'.$row['link'].'</a></td>';
}
$string .= '<td width="30"> </td>
</tr>
</table></td>
</tr>';
}
$string .= '<tr>
<td><img width="170" height="10" src="'.$baseUrl.'media/images/UI/nav/slct_bot.jpg"/></td>
</tr>
</table>';
};
return $string;
}
controller function:
function index()
{
$this->load->view('test');
}
view file:
$navInfo = array(
1 => array(
'anchor' => 'profile',
'link' => 'Profile'
),
2 => array(
'anchor' => 'alliance',
'link' => 'Alliance'
)
);
echo $this->ui->navBar('profile','profile',$navInfo); // THIS IS LINE 13
BTW, this is built in the framwork CodeIgniter (http://codeigniter.com/) and they were of no help what so ever. The error is:
Fatal error: Call to a member function navBar() on a non-object in /nfs/c02/h07/mnt/XXXXX/domains/aPlace.antiradiant.com/html/system/application/views/test.php on line 13