绕过joomla菜单系统

问题描述:

我会喜欢一段代码片段,它允许我拦截给定的URL,然后根据参数服务特定的页面。绕过joomla菜单系统

这样做的目的是,不管url的最后部分是否说'/ blah',我想要显示的页面。

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/ 

都会显示相同的文章。

感谢,

+0

这可以帮助你: 的http://计算器.com/questions/5010208/htaccess-redirect-permanent-www-domain-com -a-to-www-domain-com-ab – Shaz 2012-03-20 03:42:57

你需要时触发一个插件 'onAfterInitialise'。看一看:

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

您需要为您的功能将类似于(未测试)的代码:

/** 
* 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'); 
    } 
} 
+0

谢谢 - 我下周试试这个,让你知道它是怎么回事 – 2012-03-22 00:18:09