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 を使用して Pager をコンテンツの下に移動できます。

#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 に答える