loadsys / loadsys/CakePHP-Sitemap

Auth and template questions

Open
#53 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
26
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hello,

I'm trying to implement your plugin with some modifications in layout and also I want to enable it for the users who are not authenticated.

**1. Auth allowing**
If I put the beforeFilter function to the Sitemap plugin's controller -SitemapsController.php- and I define that the index action should be allowed for all unauthorized users...

```
public function beforeFilter(Event $event)
{
$this->Auth->allow(
'index'
);

return parent::beforeFilter($event);
}
```

...then it works correctly. But of course I don't want to modify the files in the vendor folder, so my questions is: Is there a way to set this in my application? I tried to put this to my AppController.php:

```
$this->Auth->allow(
'Sitemap.index'
);
```

But it doesn't seems to work.

**2. Custom template**
I read and tried to implement this according to the official CakePHP docs, but obviously I'm doing something wrong. I tried different paths, but they all failed:

```
src/Template/Plugin/loadsys/Sitemap/Sitemaps/xml/index.ctp
src/Template/Plugin/loadsys/Cakephp_sitemap/Sitemaps/xml/index.ctp
src/Template/Plugin/Loadsys/Cakephp_sitemap/Sitemaps/xml/index.ctp
src/Template/Plugin/Loadsys/CakephpSitemap/Sitemaps/xml/index.ctp
```

Of course, non of these worked.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading SitemapsController.php and AppController.php, then compare the plugin's template lookup with the attempted src/Template/Plugin paths. Check the CakePHP version and plugin naming conventions before investigating how authentication and template overrides are configured. Done means both unauthenticated access and an application-level custom XML template work without editing vendor files.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.