0

好的,所以这可能是一个愚蠢的问题,但我想我还是把它放在那里:
我知道这是一个简单问题的奇怪解决方案,但我需要控制分类页面中节点的列表,我不觉得我有传统的方式。所以我继续创建了一个模块来获取基于分类的节点(taxonomy_select_nodes()),我想要一个寻呼机来配合它。

这是代码:
function theModule_recipeList(){ $path = drupal_get_path_alias($_GET['q']); $args = explode("/",$path); $themePath = drupal_get_path("theme", "theTheme");

$term = taxonomy_get_term_by_name($args[1]);
$tid = $term[0]->tid;
$nodes = taxonomy_select_nodes(array($tid));

$output = "<div id='recipeListWrapper'>";
while($row = db_fetch_object($nodes)){
    $node = node_load($row->nid);

    if($node->uid != 1){
        $userClass="user";
    }
    else{
        $userClass="admin";
    }
    $output .= "
        <div class='receptThumbnailWrapper'>
            <div class='wrapper'>
                <img src='".base_path().$themePath."/graphics/recept-default-small.png' />
                <h3><a href='".base_path() . $node->path."'>".$node->title."</a></h3>
                <div class='recipeType $userClass'></div>
            </div>
        </div>
    ";
}
$output .= "</div>";

return $output;

}

现在,该模块按我的计划工作并且全部工作(即使它是一种管道胶带解决方案,我知道),并且寻呼机打印并工作。问题是寻呼机在其他任何东西之前打印。

我怀疑这是因为我在返回 $output 之前调用了 taxonomy_select_nodes,但我需要它来获取我想要的节点。

请,非常感谢任何建议。

/安德斯

4

2 回答 2

1

正如 Nikit 所建议的,我建议使用视图模块来创建您的列表。您可以使用参数从路径中选择适当的分类术语。这样您就可以获得所需的功能,而无需编写和维护代码。

于 2010-04-10T17:10:22.220 回答
0

为了与胶带方法保持一致,您可以使用 CSS 将寻呼机移动到您的内容下方。

#div-that-holds-pager-and-content {
position: relative;
padding-bottom: 50px;
}

#div-that-holds-pager {
position: absolute;
bottom: 10px;
}
于 2010-04-09T09:39:40.153 回答