having trouble with controllers |
[eluser]bradyrose[/eluser]
Hey guys. Ok.. so to start, im just barely proficient at php , so codeigniter has been a bit of a challenge.. I have appropriated code from a tutorial online to get my main page to display the index by default, and then display pages from within a folder in the views named 'pages' if there is a corresponding page name, ie, faq, about, account, etc. ok.. so this was all well and working, however for some reason when i create a new public function, i can't get it to display to screen. ultimately my goal is so that I can load a third party app when i go to something particular like, index.php/pmsystem perhaps im using the wrong path, or perhaps my previous code is somehow interfearing with the pubic function displaying... whatever it is I am stumped. Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]blekknajt[/eluser]
Check application/config/routes.php - I bet You have there (as in tutorial): Code: $route['(:any)'] = 'pages/view/$1';
[eluser]InsiteFX[/eluser]
The default controller is also set to pages/view He should be using a new controller or add it to the pages pages/ page_view method.
[eluser]bradyrose[/eluser]
below is what it in my routes Code: $route['default_controller'] = 'pages/view'; it is not functioning as i would hope. In my views folder i have a folder named pages, i would like it so that whenever i have a page such as www.cashforbtc.com/index.php/anypagename , it will go to that page in the pages folder if it exists. In addition to this, I would like it if you go to index.php/pmsystem , that it would display (with the header and footer as other pages do) our pm system which is located at application/third_party/app_pmsystem
[eluser]InsiteFX[/eluser]
You need to place them above the others. Note: Routes will run in the order they are defined. Higher routes will always take precedence over lower ones. Code: $route['pages/pm/(:any)'] = 'pages/pm/$1';
[eluser]bradyrose[/eluser]
I flipped the order in which they load, as it was posted previously it did not function at all, all pages i tried brought up blank screens. So i attempted to correct it on my own, and as it is now, these are my routes Code: /$route['pages/pmsystem/(:any)'] = 'pages/pm/$1'; Although im now back to functional for going to psges such as http://www.cashforbtc.com/index.php/login going to http://www.cashforbtc.com/index.php/pmsystem does not seem to route to /pages/login.php, or wherever i point it in the routes.
[eluser]InsiteFX[/eluser]
You do not add index.php to routes. I think you you need to read the CodeIgniter Users Guide on Routing. CodeIgniter Users Guide - URI Routing
[eluser]bradyrose[/eluser]
I have read it, however i cannot say i understand it, I always try to read the user guide before posting. The reason i have been using index.php/pagename , is because it is all that is working for me. doing pages/pagename, has not been working.
[eluser]InsiteFX[/eluser]
Thats telling me that index.php is not fully removed. To remove index.php Code: // Leave blank and CI will try to figure it out. |
Welcome Guest, Not a member yet? Register Sign In |