CodeIgniter Forums

Full Version: Link from admin dashboard are not working.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I hope some one can help me :-D

My problem is, when I click in the admin menu, to get to another admin pages, I get a error about the page "404 Page Not Found/The page you requested was not found."

Its only on the admin dashboard I have the issue, all other link works fine. Its happen after I have update the CodeIgniter.

[Image: dl.aspx?mguid=9b76728f-fed6-4b9c-802a-2a1f279d2f53]



routes.php

Code:
Route::any('admin', 'admin/dashboard');


 
navigator.php
Code:
<ul class="treeview-menu menu-open" style="display: block;">
<li><a href="<?php echo base_url();?>admin/dashboard/countries"><span>Countries</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashboard/sports"><span>Sports</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashboard/leagues"><span>Leagues</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashboard/bet_events"><span>Events</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashboard/teams"><span>Teams</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashborad/results"><span>Results</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashboard/tips"><span>Tips</span></a></li>
<li><a href="<?php echo base_url();?>bookmakers"><span>Bookmakers</span></a></li>
<?php $CI = get_instance();
$CI->load->database();
$query = $CI->db->get_where('bookmaker_reviews',array('status'=>0));
$no = $query->num_rows();
?>
<li><a href="<?php echo base_url();?>admin/dashboard/bookmaker_reviews">
<span>Bookmaker Reviews ( <?php echo $no;?> )</span></a>
</li>
<li><a href="<?php echo base_url();?>admin/dashboard/competitions"><span>Competitions</span></a></li>
<li><a href="<?php echo base_url();?>admin/dashboard/rewards"><span>Rewards</span></a></li>
<li><a href="<?php echo base_url();?>update"><span>Update</span></a></li>


/application/controllers/admin/dashboard.php
Code:
class Dashboard extends Admin_Controller
{


/**
* Controller constructor sets the Title and Permissions
*
*/
public function __construct()
{
parent::__construct();

Template::set('toolbar_title', 'Dashboard');
$this->load->model('roles/role_model');
$this->load->model('sports/sports_model');

$this->load->model('users/user_model'); 
$this->load->model('tips/tips_model'); 
$this->load->model('bet_events/bet_events_model'); 

$language = $this->input->cookie('language');
$this->lang->load('roles/roles',$language);
$this->lang->load('tips/tips',$language);

Template::set('status_counts', $this->tips_model->count_by_status()); 
$this->auth->restrict('Dashboard.View');

$this->output->cache(0);
}//end __construct()

//--------------------------------------------------------------------

/**
* Displays the initial page of the Content context
*
* @return void
*/
public function index()
{

Template::set('role_counts', $this->user_model->count_by_roles());
        Template::set('total_users', $this->user_model->count_all());
Template::set('roles', $this->role_model->where('deleted', 0)->find_all());
Template::set_view('admin/dashboard/index');
Template::render();
}//end index()
@ [email protected],

What version of CI are you using? Also, I noticed that your controller is all lowercase. The file is suppose to have the first character capitalized (.../admin/Dashboard.php instead of .../admin/dashboard.php).
Not sure if you remove index.php or not, but this:

PHP Code:
<a href="<?php echo base_url();?>admin/dashboard/countries"><span>Countries</span></a

Should be this:
PHP Code:
<a href="<?php echo site_url('admin/dashboard/countries); ?>"><span>Countries</span></a

base_url will only add domain, and site_url will add domain and index.php, if needed.

When you link to CodeIgniter page or controller, use site_url, when you link to resource files like CSS or JS or images, use base_url.
(08-13-2018, 04:34 PM)php_rocs Wrote: [ -> ]@ [email protected],

What version of CI are you using? Also, I noticed that your controller is all lowercase.  The file is suppose to have the first character capitalized (.../admin/Dashboard.php instead of .../admin/dashboard.php).

I use version 3.18, and I have controll again :-D, and all the controller, are the first character are capitalized. Have you other ideas :-D
(08-14-2018, 12:24 AM)Pertti Wrote: [ -> ]Not sure if you remove index.php or not, but this:

PHP Code:
<a href="<?php echo base_url();?>admin/dashboard/countries"><span>Countries</span></a

Should be this:
PHP Code:
<a href="<?php echo site_url('admin/dashboard/countries); ?>"><span>Countries</span></a

base_url will only add domain, and site_url will add domain and index.php, if needed.

When you link to CodeIgniter page or controller, use site_url, when you link to resource files like CSS or JS or images, use base_url.

Its the same, all the url link not working, on the admin site. Can I move the controllers to another folder ?