[eluser]Keem1[/eluser]
Hi Guys!
I need a controller-depended menu (view), what loads if a file exists in view directory, like this:
Example controller: contact.
If you navigate to mypage.com/contact/, and the following file exists: view/menu/contact_menu_view.php, this view loads, else do nothing.
I've tried this, but not worked:
Code:
$controllername = $this->uri->segment(1);
if (@file_exists(APPPATH."view/menu/{$controllername}_menu_view.php"))
{
$this->load->view("menu/{$controllername}_menu_view.php");
}
If comment the "if" line, and the view file exists, load it fine. The problems begin there when no view files with same syntax the name of controller (an error message will be thrown).
What should I do to solving this problem?
Edit:
I've edited the missing dollar signs