Include sitemap in cakephp - cakephp

I generated a normal sitemap with an online Sitemalgenerator:
http://xml-sitemaps.com
Now I tried to include it like every other Sitemap on a Server.
The problem is, on this Server seems to be a CakePHP Framework and I dont know, how it works cause
I dont have any experience in PHP.
The error:
Missing Controller
Error: Sitemap.xmlController could not be found.
Error: Create the class Sitemap.xmlController below in file: app/Controller/Sitemap.xmlController.php
<?php
class Sitemap.xmlController extends AppController {
}
Can you tell me, how to include a XML Sitemap in the easiest way? I'm a beginner in Webprogramming!
(I dont want to create a dynamic Sitemap)
Thank you!

Place your file in your webroot folder:
app/webroot/Sitemap.xml
As long as the file is found in the webroot CakePHP will load it, if the file is not found it will run through its normal application request cycle based on your defined routes.

Related

Target class [App\\Http\\EnsureFrontendRequestsAreStateful] does not exist

I am using Laravel Sanctum to authenticate a react SPA with a laravel API backend.
While I am trying to access routes which does not need authentication, I am getting this error:
"Target class [App\Http\EnsureFrontendRequestsAreStateful] does not exist."
What should I do to guard only some routes, while leaving others open.
You are probably missing the import in the app/Http/Kernel.php file.
// app/Http/Kernel.php
<?php
namespace App\Http;
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
This can usually be solved with: composer dump-autoload
You can read more about what the command does here
composer dump-autoload won’t download a thing. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php). Ideal for when you have a new class inside your project.

CakePHP 3 Audit Log, working with admin routes?

I'm trying to work with this CakePHP 3 plugin which I think does exactly what I need it to do, but am struggling big time! I'm new to CakePHP 3, composer and fiddling with routes etc (previously CakePHP 2.x and manual installation and never played with routes).
The plugin does not appear to be maintained any longer and the package does not exist when trying to install via composer, so I forked it and cloned the files to /plugins/AuditLog/
I've run updated my app composer.json file, loaded the plugin in my bootstrap.php, and run composer install on /plugins/AuditLog/ to load the dependencies from the plugin composer.json file (not sure if this is the right thing to do?)
In plugins/AuditLog/config/routes.php there is the following code
Router::plugin('AuditLog', function ($routes) {
$routes->prefix('admin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$routes->fallbacks('DashedRoute');
});
So a bit of searching in the CookBook and I read for the first time about 'prefix routing', which from what I can tell means I should be able to reach the pages via /admin/audit-log/audits (for example).
Not surprisingly, I get a missing controller error here
Error: Create the class AdminController below in file: src/Controller/AdminController.php
The instructions for the plugin don't mention anything about creating an admin controller, and there are no controller files anywhere in the plugin at all actually, despite there being views and models.
I'm really out of my depth here, can anyone help me untangle this? Where/how to add which controllers and get them pointing to the right place?

The apphelper file is not found on cakephp but it exists

I had my cakephp project working fine until I made a copy of a few files and now I get this error.
I checked the folders and they should not have a
1)class helper should not be in the same folder of apphelper
2)helper should not be in the same folder as form helper with my version of cakephp.
These errors dont make sense so how do I fix this?
The errors are listed here
http://182.160.156.223/~aptutori/crm/users/login

CakePHP Twitter plugin

Appologies if this is something obvious I've missed.
I'm trying to use this Cake plugin to add a twitter feed to my cake app (just display my latest tweet). I've followed the docs in the readme but I get this:
Missing Controller
Error: Twitter.UsersController could not be found.
Error: Create the class UsersController below in file: C:\wamp\www\mysite\app\Plugin\Twitter\Controller\UsersController.php
Heres what I've done so far (as the readme instructs):
Cloned all the files into app/Plugin/Twitter/
Rename Config/twitter.default.php to Config/twitter.php
Updated the config file with my twitter app keys
Visited mysite/twitter/twitter/connect - which gives me the above error.
The readme mentions that the plugin uses - http_socket_oauth, another cake plugin, I trust that this is included in this plugin and that I dont have to install that plugin aswel?
Could someone point me in the right direction?
Thank you

CakePHP 2.0 Plugin URL

Trying to get CakePHP work with subfolders for Controllers, Views, or Models is not really working and from what I've read I need to use "Plugins". Right now I have the following folder structure:
/app/Plugin/Manager/
/Controller
CandyController.php
/Models
/View
/Candy
viewCandy.ctp
ManagerAppController.php
ManagerAppModel.php
When I try and set my url to: http://localhost/Manager/Candy/viewCandy/123. I get the error message: "ManagerController does not exist". Why is CakePHP not picking up that it should look in the Manager plugin folder?
Now that 2.0 has been released the docs are fleshed out a bit more. This is described in the Plugin section of the cookbook.
They suggest putting this in bootstrap.php instead of routes.php:
CakePlugin::loadAll(); // Loads all plugins at once
CakePlugin::load('ContactManager'); //Loads a single plugin
Here is the solution:
Go to /app/Config/routes.php and add the line CakePlugin::load(array('YourPluginName')); after the line CakePlugin::routes();. In my case it was line 40.
Basically CakePHP 2.0 doesn't automatically load plugins. I think that's fine and dandy, but there isn't really any documentation for this.

Resources