load view inside view in codeigniter - codeigniter

Actually m using ahref with onclick function inside my view
<a href="<? echo base_url();?>index.php/manager/engineer" onclick=window.open("<? echo base_url();?>index.php/manager/engineer") >
it is redirecting to url correctly
http://localhost:8888/CI/index.php/manager/engineer
but in that page m getting error as
The page you requested was not found.
even though i have created engineers view file
Anyone helping me to find the solution will be needfull

the CI router just run external links of controller classes and you can't load views externally. instead on you can load views internally on your controllers and now open the controller address via your browsers.
see more : http://ellislab.com/codeigniter/user-guide/general/views.html

Related

Laravel application will not route properly

I am trying to create a first application using TCPDF and Laravel 8. I have an initial page which has a listing of users from a MySQL table and two buttons (Download PDF and View PDF)
There are three routes setup in my web.php file:
Route::get('/', 'App\Http\Controllers\UserController#index');
Route::get('download', 'App\Http\Controllers\PDFTestController#savePDF')->name('download');
Route::get('viewpdf', 'App\Http\Controllers\PDFTestController#openPDF')->name('viewpdf');
I have tried creating the buttons and their actions several different ways but the result is always the same:
// The download button
<button type="button" onclick="window.location='{{ route("download")}}'" class="btn btn-success btn-sm">Download PDF</button>
// The view button
Open PDF
The route for the home page correctly calls App\Http\Controllers\UserController#index and the expected page is displayed.
However, when I try the download page all I get is a 404 "The requested URL was not found on this server." and the URL it is trying is .../LaravelPDF/public/download
Clicking the View button results in a 404 as well and the URL is /LaravelPDF/public/viewpdf
I put some DD() calls in the various functions and it does not appear that they are ever being called. Instead Laravel is trying to open a view named download or viewpdf.
I even tried creating a download.blade.php file but that does not open either.
What am I doing wrong? Thank you in advance for your help.
Just Run your terminal
php artisan route:clear

Handling multiple views controllers in CodeIgniter 4

I am new to CodeIgniter 4.
I have one controller named Pages and helps to display website pages normally. Then I have another controller named Admin which is suppose to load the admin view with its own header and footer files.
While Pages controller works fine, the Admin controller keeps saying 404-file not found admin.
I think I have a problem with my current Route settings below. Please help.
$routes->setDefaultController('Pages');
$routes->setDefaultMethod('default');
// Route Definitions
$routes->get('/', 'Pages::index');
$routes->get('(:any)', 'Pages::default/$1');
try ajusting your code like this.
$routes->setDefaultController('Pages');
$routes->setDefaultMethod('default');
// Route Definitions
$routes->resource('pages');
$routes->get('/', 'Pages::index');
$routes->get('(:any)', 'Pages::default/$1');

Render the sitemap at 404 page cs-cart (4.5.x)

Is there a way to show the sitemap at 404 page in cs-cart(4.5.x)? What I did is copied the sitemap.tpl code inside the 404.tpl, but it just renders empty container without links. I think the sitemap controller should be called somehow to populate the sitemap but I have no idea how to do it. May be u can give me any hint?
So to call sitemap controller when the 404 renders I had to hook up fn_control function by using before_dispatch(http://www.cs-cart.com/api#312352) and to copy the sitemap controller code inside that hook function. That's all.

How OpenCart controller handles route=catalog/product/edit. Which view file?

I want to know which view file OpenCart controller uses when it redirects to route=catalog/product/edit, in the admin area.
I want to change the HTML code of that HTML file. If it is product_form.tpl it is not showing any changes when I edit it.

CodeIgniter url not working for new class

I uploaded CodeIgniter in my server, and the basic page works fine.
Then I added home.php file in application/controllers folder with class Hello and function one, and tried to open the link url/index.php/Hello/one but I get the codeIgniter error that the page isn't found. What can I be missing?
To fix your issue you should rename the Hello class to Home then go to URL/index.php/home/one
I recommend that you read up on the controller documentation:
http://ellislab.com/codeigniter/user-guide/general/controllers.html
A Controller is simply a class file that is named in a way that can be
associated with a URI.
Consider this URI: example.com/index.php/blog/
In the above example, CodeIgniter would attempt to find a controller
named blog.php and load it.
When a controller's name matches the first segment of a URI, it will
be loaded.

Resources