2017-12-13 3 views

답변

0

예 - 이것이 Joomla가 작동하는 방식입니다. yoursite.com/my-category/123-blablabla과 같은 것이 있으면 joomla는 123이라는 ID를 가진 기사를로드합니다. 실제로 ID가 123 인 기사는 my-category 카테고리에있을 필요조차 없습니다. 이 Joomla에서 이상한 것들 중 하나입니다.

here과 같이 URL에서 기사 ID를 제거하는 방법이 있습니다. 2 가지를 염두에 두라. 1) 핵심 수정이며 2) 그렇게하는 방법에 대한 지침은 3.8. +에서 약간 다를 수 있습니다.

0

나는 해결책을 찾는다. ContentRouterRules 레거시 클래스에서 메서드 파싱을 찾고 db에 대한 호출 쿼리가 문서 정보를 실행하는 곳을 찾습니다.

$query = $db->getQuery(true) 
       ->select($db->quoteName(array('alias', 'catid'))) 
       ->from($db->quoteName('#__content')) 
       ->where($db->quoteName('id') . ' = ' . (int) $id,'AND') 
       ->where($db->quoteName('alias') . ' = ' . "'$alias'"); 

      $db->setQuery($query); 
      $article = $db->loadObject(); 

      if ($article) 
      { 
       if ($article->alias == $alias) 
       { 
        $vars['view'] = 'article'; 
        $vars['catid'] = (int) $article->catid; 
        $vars['id'] = (int) $id; 

        return; 
       } 
      } 
      else 
      { 
       header('HTTP/1.0 404 Not Found'); 

       JError::raiseError(404, 'JGLOBAL_RESOURCE_NOT_FOUND'); 

       exit(404); 
      }