object not found error 404-codeigniter framework-xampp server - php

Iam new to codeigniter framework and xampp server.Iam getting object not found error
when i click on fivespecies it is displaying error message

The welcome.php controller is your default, and when you don't declare a function name within the controller, it loads the index() function, so loading http://localhost/antimalarial/ loads the index function in your welcome controller.
However, if you want to load any other function within the welcome controller, you will need to provide the controller name AND the function name.
Your link should be http://localhost/antimalarial/welcome/fivespecies

Your might need to write your URL as: http://localhost/antimalarial/Welcome/fivespecies
If this link does not work, try this:
http://localhost/antimalarial/index.php/Welcome/fivespecies
This case is valid if you haven't already set the .htaccess file.
If you want to remove index.php from your url. Please download and add .htaccess file in your root directory. Click here to download the file.
Hope this helps.

Related

PageHandler In php

I am currently working in a application like wordpress. i need a php class to handle the url request for eg : if u load the below url in browser
http://somename.com/myaboutpage/
the handler should load the file about-us.php from my theme folder
and if i use the below url
http://somename.com/action/login/
the handler should trigger the file login-action.php from my application core and return the values
how its possible..
i tried to study how elgg & wordpress handle the request. but i am unable to get the exact..
so please help me.
Note the pages i create will be dynamic so i need a page handler fully dynimic like word press permalink handler
Have you set a BASE_URL in an index.php file? if you have, you could check to see if that is set, if it isn't it means the user has somehow managed to navigate directly to your about-us.php file. So something like
if(!defined('BASE_URL'))
{
require('/*your index.php file*/');
header('Location: BASE_URL')
exit;
}

Codeigniter Loading external site in default controller

I'm not able to figure this out on my own so here I am asking for your help.
How do I load a website that I already made as a view in the code igniter default controller?
I put my website under a folder name site, and in the default controller I loaded the view site/index , but then in my site there are problems with the includes and redirects... I don't know why, I guess the way the site usually works with redirecting isn't compatible with code igniter style
edit: I guess I would have to turn off CI engine for this site, but I don't know why, because I would still need codeingiter to manage other parts of my application
"CodeIgniter can be told to load a default controller when a URI is not present, as will be the case when only your site root URL is requested. To specify a default controller, open your application/config/routes.php file and set this variable:
$route['default_controller'] = 'Blog';
Where Blog is the name of the controller class you want used. If you now load your main index.php file without specifying any URI segments you'll see your Hello World message by default."
http://codeigniter.com/user_guide/general/controllers.html
fragment copied from that link , you should put the controllers classname in that config, not the view
I guess it's better to choose one of these options:
Modify the existing site to a CodeIgniter site.
Keep your site separate from the CodeIgniter site, and just link between the two sites.
The way you are trying to do it seems very useless and causing a lot of extra trouble.
You can simply use the redirect function in your controller. If you supply a full URL you can go to any other page. You will, of course, leave your CI app.
redirect('http://www.example.net/page_in_external_site/');
Try using the APPPATH constant when defining the paths for the includes.
I know it's an old question, but you can try using a view template with an iframe, and you can pass the URL to the src property of the iframe. That way you can display your site inside a view, but still can't get access to the vars passed to the view from your site.
In system/Core/Loader.php change the line 141 to look like this:
$this->_ci_view_paths = array(APPPATH . 'views/' => TRUE, FCPATH => TRUE);
and to get the view is simple:
$this->load->view('application/ PATH_TO_VIEW');

Redirect from an action method to a php file and disable the checking of url by zend

In my indexAction() I want to redirect to a php file which is located in public folder named login.php.Now When I run this project as giving the url http://example.com:8881/index, it executes.In indexAction I have specified as $form_object = new Application_Form_Login().This form has a submit button and when submit button is clicked,in indexAction() I have specified as
if($form_object->isValid($login_data))
{
$this->_helper->redirector->gotoUrlAndExit('/public/login.php');
}
Because I want to redirect to login.php which is located in public folder.But when I click on submit url changes from http://example.com:8881/index to http://example.com:8881/public/login.php and says an error as Invalid controller specified (public) .I know why this error has occured because in url zend treats the public as controller which is not there.Now this checking should be disabled by the zend so that we can call that php file otherwise in url after the localhost everything will be treated as controller/action.What to do now for above stated requirement?Should I place the login.php file in other folder?What else has to be done?
Please suggest me.Its very much needed.Thanks in advance.
/public/ should never appear in your URLs. Sounds like you simply want to redirect to /login.php:
$this->_helper->redirector->gotoUrlAndExit('/login.php');
If this doesn't work please edit your question to include the contents of your .htaccess file.

Need help with Code Igniter [did not found page created]

so I hope someone would help me.
My first page is leave_app.php. In this page I put a link to apply leave, using the normal code:
New Leave Application
However the link didn't display as I had wished for.
"The requested URL /ci/add.php was not found on this server." and the link in the browser leads to this "http://localhost/ci/add.php".
I don't know why the server didn't find the page. I already made add.php page, also add at the leave_app controller the function add().
In the config.php file I put $config['index_page'] = '';
I have asked around but no one can help. I have already surfed around, but still don't know how to solve.
The beauty of Codeigniter is to rewrite urls in a clean manner, so all things go through index.php and the corresponding controller is loaded
Try accessing it like so:
/ci/index.php/add
Make sure your controller is in application\controllers\add.php and named Class Add

Zend scripts not setup correctly I think

When Ive created a new controller, ie in this case Authenticate, Ive also created the folder and file application/views/scripts/authentication/index.phtml
Not a problem when hitting the url http://dev.local/authentication/ but when calling any action ie http://dev.local/authentication/login, I get the error below.
Message: script 'authentication/login.phtml' not found in path (C:\Sites\application\views\scripts\)
Regardless of any changes Im going to make to the login action it shouldnt automatically ask for a new page right? or am I wrong?
By default, each action requires its corresponding view (phtml page). If you want to disable a view/layout for a given action, you can use the following code :
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
EDIT in response to the comment:
I usually don't need to do this, because the actions I have that don't need a view script are redirected/forwared to other actions. For example, once your user is authenticated (i.e. when /authentication/login succeeds), you can redirect him to the home page (or whatever page he was trying to access. Similarly, if the login failed, I simply set an error message in the view and forward to the action that shows the login form.
The only actions for which I use the above code is for actions that are typically called using AJAX and that output some JSON code, for example.

Categories