我的以下代码基于 1.获取当前 URL 2.遍历数组并检查 url value = to value in array 是否这样做:
$on_this_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
foreach ($city_array as $sandwich) {
if (strpos($on_this_link, $sandwich) == true) {
$sandwich = trim($sandwich, '/');
$city = $sandwich;
if ($city == 'newyork') {
foreach ($category_array as $double_sandwich) {
if (strpos($on_this_link, $double_sandwich) == true) {
$double_sandwich = trim($double_sandwich, '/');
$category_is = $double_sandwich;
Loader::model('page_list');
$nh = Loader::helper('navigation');
$pl = new PageList();
$pl->filterByAttribute('city', '%' . $city . '%', 'like');
$pl->filterByAttribute('category','%'.$category_is.'%','like');
$pl->sortByDisplayOrder();
$pagelist = $pl->get();
foreach ($pagelist as $p) {
echo '<li> <a href="' . $nh->getLinkToCollection($p) . '">' .htmlspecialchars($p->getCollectionName()) . '</a> </li>';
?>
}
}
}
}
所以它只会显示与 URL 具有相同属性的页面每个页面都有我想要显示的图像属性。我怎样才能传递这个图像属性?