绕过joomla菜单系统 [英] bypass joomla menu system

查看:74
本文介绍了绕过joomla菜单系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很喜欢一个代码段,该代码段使我可以截取给定的URL,然后根据参数为特定页面提供服务.

I would love a code snippet that allowed me to intercept the URL given and then depending on a parameter serve a specific page.

目的是无论URL的最后一部分是否显示"/blah",都将显示我想要的页面.

The purpose would be that no matter the url if the last part of the url had say '/blah' the page I wanted would display.

ex 1: http://website/index.php/blah/
ex 2: http://website/index.php/blogcategory/articlex/blah/
ex 3: http://website/index.php/blogcategory/article5/blah/

都将显示同一篇文章.

谢谢

垫子

推荐答案

您需要一个由"onAfterInitialise"触发的插件.看看:

You need a plugin that is triggered 'onAfterInitialise'. Have a look at:

http://docs.joomla.org/Plugin/Events/System#onAfterInitialise

函数所需的代码类似于(未经测试):

The code you need for your function would be something like (not tested):

/**
* Do something onAfterInitialise
*/
function onAfterInitialise()
{
    // check for occurrence of string in url
    $findme = 'blah';
    $myuri = JRequest::getURI();
    $tocheck = strpos($myuri, $findme);

    if ($tocheck === true) {
        $app = JFactory::getApplication();
        $app->redirect('/anywhereyouwant'); 
    }
}

这篇关于绕过joomla菜单系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆