누락 된 URL에 대한 오류 페이지 (404 페이지)를 만들었습니다. 그것은 표준 방식이나 템플릿의 error.php 파일에서 수행됩니다.joomla 2.5 오류 페이지
오류 페이지가 제대로 작동, Joomla 문서로 올바르게 리디렉션됩니다. 내 문제는 사용자가 클릭 한 링크를 캡처하여 404 페이지를 생성하고 싶다는 것입니다. 내 생각은 나에게 실종 된 페이지를 이메일로 보낸 error.php 페이지의 상단에 약간의 코드를 삽입하는 것이 었습니다 :
<?php
defined('_JEXEC') or die;
$app = JFactory::getApplication();
$menu = $app->getMenu();
$menuItem = $menu->getItems('link', 'index.php?option=com_example&view=reporting', true);
$ref = JRoute::_('index.php?Itemid='.$menuItem->id);
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->getValue('config.mailfrom'),
$config->getValue('config.fromname'));
$mailer->setSender($sender);
$recipient = array('[email protected]');
$mailer->addRecipient($recipient);
$body = "Missing page is ".$ref;
$mailer->setSubject('404 Error Generated by your site');
$mailer->setBody($body);
$send = $mailer->Send();
if ($send !== true) {
echo 'Error sending email: ' . $send->__toString();
} else {
echo 'Mail sent';
}
header("Location: http://www.domain.com/404-page.html"); /* Redirect browser */
exit();?>
을하지만 항목 ID를 얻을 수 없습니다. 참조 페이지를 얻을 수 있습니다 $ _SESSION [ "origURL"] = $ _SERVER [ "HTTP_REFERER"]; 그러나 이것은 내가 찾고있는 누락 된 페이지의 ID이기 때문에 아무 쓸모가 없습니다.
아이디어가 있으십니까? 나는 메뉴 항목을 클릭 할 때마다 업데이트되는 세션 변수를 만들어야 만하는지 궁금해했다. 데이비드 T에
감사
앨런
[이 스레드] (http://forum.joomla.org/viewtopic.php?f=621&t=685323&view=next)는 Joomla 1.5에서 유용하지만 도움이된다면 약간 변형 할 수 있습니다. 사용되지 않습니다. – DavidT