0

由于某些 php 代码不断将其重定向到自身,我无法弄清楚如何让一个页面在不重定向到自身的情况下单击它的链接。

$option = $_GET[option];
$view = $_GET[view];

if (!$option) {
    include "include/index_main.php"; // INDEX MAIN TOP FILE
} 
elseif ($option == 'com_newsfeeds' and $view == 'newsfeed') {
    include "include/news.php"; // NEWS FILE
} 
elseif ($option == 'com_content' and $view == 'category') {
    switch($_GET[id]) {
        case '75':
            include "include/children_list.php"; // Children List FILE
            break;
        case '77':
            include "include/food_for_kids.php"; // Food 4 Kids page
            break;
        case '76':
            include "include/water_for_life.php"; // Water for Life page
            break;
        default:
            if (empty($_GET[listing_id]) || $_GET[listing_id] == '') {
                include "include/projects.php"; // Projects FILE
                break;  
            }
            else {
                include "include/project_list.php"; // Project Listing FILE 
                break;
            }
    }   
}
elseif... ... ...

当页面没有任何指向它自己的类别的链接时,这很有效,但是带有标记的地图都有似乎被重定向回页面而不是它们应该去的地方的链接。

问题在于案例'76':部分

据我所知,当类别 id 为 76 时,php 调用 water_for_life.php 包含。不幸的是,它没有区分:

.org/index.php?option=com_content&view=category&id=76

.org/index.php?option=com_content&view=category&id=76&listing_id=76&sid=dl94q3tlfqr2s58c3u1mfnf1t1

所以毕竟,我想我的问题是:

一旦有人单击具有如下链接的链接,有没有办法将其一直跳过到include/project_list.php :

.org/index.php?option=com_content&view=category&id=76&listing_id=76&sid=dl94q3tlfqr2s58c3u1mfnf1t1

?

4

1 回答 1

0

你的意思是这样的?请注意,它适用于与 id 无关的所有情况,无论是 76 还是 77 或其他

...
elseif ($option == 'com_content' and $view == 'category') {
if (!empty($_GET['listing_id'])) {
    include "include/project_list.php"; // Project Listing FILE 
}
else {
  switch($_GET['id']) {
    case '75':
        include "include/children_list.php"; // Children List FILE
        break;
    case '77':
        include "include/food_for_kids.php"; // Food 4 Kids page
        break;
    case '76':
        include "include/water_for_life.php"; // Water for Life page
        break;
    default:
        include "include/projects.php"; // Projects FILE
        break;  
    } 
}
...
于 2013-02-28T17:31:22.073 回答