0
我在我的項目中有兩個帖子類別,並且這兩個類別都使用不同的視圖。我正在使用fishpig插件來添加和分類帖子,但這兩個類別帖子都使用相同的view.phtml模板來顯示帖子。如何在Magento Fishpig的自定義模板中顯示類別帖子?
<wordpress_post_view>
<reference name="content">
<block type="wordpress/post_view" name="wp.post.view" template="wordpress/post/view.phtml">
<block type="core/text_list" name="post.content.before" as="before_post_content" />
<block type="core/text_list" name="post.content.after" as="after_post_content">
<block type="wordpress/post_meta" name="wp.post.view.meta" as="meta" after="-" template="wordpress/post/meta.phtml">
<action method="setDisplayPreviousNextLinks"><display>1</display></action>
</block>
</block>
<block type="wordpress/post_view_comment_wrapper" name="wp.post.view.comments" as="comments" template="wordpress/post/view/comment/wrapper.phtml">
<block type="wordpress/post_view_comments" name="wp.post.view.comments.list" as="comment_list" template="wordpress/post/view/comments.phtml" />
<block type="wordpress/post_view_comment_pager" name="wp.post.view.comments.pager" as="pager"/>
<block type="wordpress/post_view_comment_form" name="wp.post.view.comments.form" as="form" template="wordpress/post/view/comment/form.phtml">
<block type="core/text_list" name="wp.post.view.comments.form.before_end" as="before_form_end" />
</block>
</block>
</block>
</reference>
</wordpress_post_view>
有沒有什麼辦法可以分離發佈視圖?
謝謝本,分類的帖子應該使用郵政類型和分類擴展嗎? –
如果你想使用類別,你需要調用$ post-> getTermCollection('category')並遍歷這些類別來確定這個帖子在哪個類別。要按帖子類型拆分,你需要Post類型的add-延期。 –
雖然我試圖使用getTermCollection('category')它顯示**調用成員函數getTermCollection()上的一個非對象**可以請你分享我的語法? –