picoでsummaryができたー!
20081028
ずっとずっとpicoでsummaryが欲しいと思ってたんですが、
他力本願で実装を待っている状態だったので、
今までは苦肉の策としてテンプレートに<{$content.body|strip_tags|truncate:"100"}>とかして
本文の最初の方を概要として表示させてたんですが
今更ながらにextra_fieldsの存在を知り、今日試してみました!
まずpicoを1.73にバージョンアップして、次に modifier.pico_extra_fields.php を
root_path/class/smarty/plugins/ に放りこみました。
で、テーマ下テンプレートを利用、とのことだったので、
* XOOPS_TRUST_PATH/modules/pico/templates/main_content_form.html
* XOOPS_TRUST_PATH/modules/pico/templates/main_listcontents.html
* XOOPS_TRUST_PATH/modules/pico/templates/main_viewcontent.html
の三つを
* XOOPS_ROOT_PATH/themes/YOURTHEME/templates/xxx_main_content_form.html
* XOOPS_ROOT_PATH/themes/YOURTHEME/templates/xxx_main_listcontents.html
* XOOPS_ROOT_PATH/themes/YOURTHEME/templates/xxx_main_viewcontent.html
としてアップロード。
まず xxx_main_content_form.html 内のsubject の後くらいに
<!-- summary--><br /> <tr valign="top" align="left"><br /> <th class="head"><label for="summary">概要</label></th><br /> <td class="odd"><br /> <input type="text" name="extra_fields_summary" id="summary" value="<{"summary"|pico_extra_fields:$content|escape}>" /><br /> </td><br /> </tr>
としてあげます。これで概要を保存できるようになりましたー!
表示側は
■xxx_main_listcontents.html 72行目
<{* unserialize *}>
<{php}>$this->assign( 'ef',unserialize( $this->_tpl_vars['content']['extra_fields'] ) ) ;<{/php}>
■xxx_main_listcontents.html 84行目
<{$ef.summary|escape}>
■xxx_main_viewcontent.html 1行目
<{php}>$this->assign( 'ef',unserialize( $this->_tpl_vars['content']['extra_fields'] ) ) ;<{/php}>
■xxx_main_viewcontent.html 39行目
として完成
これで無事に概要が表示されるようになりましたー!ちょっと感動ー!
他力本願で実装を待っている状態だったので、
今までは苦肉の策としてテンプレートに<{$content.body|strip_tags|truncate:"100"}>とかして
本文の最初の方を概要として表示させてたんですが
今更ながらにextra_fieldsの存在を知り、今日試してみました!
まずpicoを1.73にバージョンアップして、次に modifier.pico_extra_fields.php を
root_path/class/smarty/plugins/ に放りこみました。
で、テーマ下テンプレートを利用、とのことだったので、
* XOOPS_TRUST_PATH/modules/pico/templates/main_content_form.html
* XOOPS_TRUST_PATH/modules/pico/templates/main_listcontents.html
* XOOPS_TRUST_PATH/modules/pico/templates/main_viewcontent.html
の三つを
* XOOPS_ROOT_PATH/themes/YOURTHEME/templates/xxx_main_content_form.html
* XOOPS_ROOT_PATH/themes/YOURTHEME/templates/xxx_main_listcontents.html
* XOOPS_ROOT_PATH/themes/YOURTHEME/templates/xxx_main_viewcontent.html
としてアップロード。
まず xxx_main_content_form.html 内のsubject の後くらいに
<!-- summary--><br /> <tr valign="top" align="left"><br /> <th class="head"><label for="summary">概要</label></th><br /> <td class="odd"><br /> <input type="text" name="extra_fields_summary" id="summary" value="<{"summary"|pico_extra_fields:$content|escape}>" /><br /> </td><br /> </tr>
としてあげます。これで概要を保存できるようになりましたー!
表示側は
■xxx_main_listcontents.html 72行目
<{php}>$this->assign( 'ef',unserialize( $this->_tpl_vars['content']['extra_fields'] ) ) ;<{/php}>
■xxx_main_listcontents.html 84行目
■xxx_main_viewcontent.html 1行目
■xxx_main_viewcontent.html 39行目
<{$ef.summary|escape}>
として完成
これで無事に概要が表示されるようになりましたー!ちょっと感動ー!