admin管理员组文章数量:1192157
In joomla 3 I use the "simple custom router manager" plugin where I configured a regex rule with which I can render a menu item (article). How can I replicate the same thing in joomla 5?
This is simple custom router manager in joomla 3
I tried to create a custom plugin but I end up on the 404 page.
<?php
defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
class PlgSystemCustomRouter extends CMSPlugin
{
public function onAfterInitialise()
{
$app = Factory::getApplication();
if ($app->isClient('site'))
{
$input = $app->input;
$uri = Uri::getInstance();
$path = $uri->getPath();
if (preg_match('#^viaggi/(\d+)-([a-zA-Z0-9-]+)$#', $path)) {
$input->set('option', 'com_content');
$input->set('view', 'article');
$input->set('id', 2);
$input->set('Itemid', 104);
}
}
}
}
本文标签: Custom plugin for routing in Joomla 5Stack Overflow
版权声明:本文标题:Custom plugin for routing in Joomla 5 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738420852a2085855.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论