我无法弄清楚如何让一个页面让它的链接被点击而不会重定向到它自己,因为一些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... ... ...
当页面没有任何指向它自己类别的链接时,这很有用,但带有标记的地图都有链接,这些链接似乎被重定向回页面而不是它们应该去的地方。 / p>
问题在于案例'76':部分
据我所知,当类别id为76时,php会调用water_for_life.php include。不幸的是,它没有区分:
.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
答案 0 :(得分: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;
}
}
...