Drupal:引数を使用した動的ビュー
-
27-09-2019 - |
質問
現在のプロジェクトでは、ギャラリーの詳細ページを表示するために特定のビューを設定する必要があります。このように機能するはずです:
1. User clicked a node (costum-post-type: gallery)
2. User received an overview page with linked images
3. User clicked an image
4. User received the gallery page (gallerific view)
ステップ1-3が完了しました。しかし、概要ページのデータを使用してDrupalに詳細ページを作成するにはどうすればよいですか?
たとえば、このようなもの: http://example.com/gallery-1/detail
また http://example.com/gallery-2/detail
.
/gallery-n
リンクされた画像を備えた概要ページです detail
の詳細ページです /gallery-n
.
あなたが私が何を意味するかを理解することを願っていますか?!
編集
概要ページには、それぞれがディテールギャラリー(jQuery Galleriffic)ページにリンクされているサンバイルがたくさんあります。
解決
私があなたの問題を正しく理解しているなら、あなたはこのことをするべきです。
1. Create view1 for page with linked images. It should be page display with http://example.com/images/%nid
where %nid is nid argument of gallery.
2. Create view2 for gallery detailed page. it should be page display with http://example.com/%nid/detail
3. Theme that views as you want.
4. For view1 for image field use override output in field settings to make it links to %nid/detail
ps必要な場合は関係を使用します。説明が明確でない場合は、自由にご尋ねます。
他のヒント
このようなことを試すことができます。カスタムモジュールを作成します(または既に持っているかもしれません):メニューに必要なページにパスを設定し、関数を呼び出すコールバックとして設定して、何でもレンダリングできます欲しい、またはあなたが望むものは何でも電話してください。
function MODULENAME_menu() {
$items = array();
$items['gallery/%/detail'] = array(
'title' => 'Gallery Detail',
'page callback' => 'MODULENAME_gallery_detail_page',
'page arguments' => array(1),
'access callback' => TRUE,
'type' => MENU_CALLBACK
);
return $items;
}
function MODULENAME_gallery_detail_page($gallery_id) {
// Here you can render the view as a page, using the gallery
// id which you passed as a parameter to this function.
// So Change MYCUSTOMVIEW to the view you want to render
$view = views_get_view('MYCUSTOMVIEW');
print views_build_view('page', $view, array(), false, false);
}
モジュールの名前でモジュールネームを変更するだけです。 views_build_viewを呼び出すときにいくつかの作業を行う必要があるかもしれませんが、それはスタートである必要があります。あなたが好きなら、もう少し質問することができます。
所属していません StackOverflow