简体   繁体   English

Joomla - 页面渲染控件

[英]Joomla - page rendering control

Is it possible to render another page instead of one currently being processed? 是否可以渲染另一个页面而不是当前正在处理的页面?

For instance, my plugin detects 404 error, sets corresponding HTTP headers, and then outputs a normal page from website - but under those HTTP 404 headers, so the browser and search engines will receive custom, good-looking 404 page. 例如,我的插件检测到404错误,设置相应的HTTP标头,然后从网站输出正常页面 - 但在这些HTTP 404标题下,所以浏览器和搜索引擎将收到自定义,漂亮的404页面。

Redirecting by 重定向

<? header("Location: ...'); ?>

is not an option. 不是一种选择。 I need stop rendering current page and render another, but display it under this, non-existing url. 我需要停止渲染当前页面并渲染另一个页面,但是在这个不存在的URL下显示它。

How this can be done? 怎么做到这一点?

Sounds like you need a system event plugin, please see: 听起来你需要一个系统事件插件,请看:

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

in particular, the onAfterDispatch method: 特别是onAfterDispatch方法:

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

The onAfterDispatch method is called after routing, and after Joomla has determined whether the url is valid, so it should be the time to get involved and redirect to another page. 路由后调用onAfterDispatch方法,在Joomla确定url是否有效之后,应该是参与并重定向到另一个页面的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM