XOOPS2.5.1aで動く、smartyプラグイン xoopsdhtmltareaを作ってみました。
以下を、(htdocs)/class/smarty/xoops_plugins/ 内に、 「function.xoopsdhtmltarea.php」としてアップします。
これで、d3forumも、d3diaryも、オリジナルテンプレートのままで動作します。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| <?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: xoopsdhtmltarea
* Version: 1.0
* Date: Jun 6, 2004 (modified 2011-08-23 for XOOPS 2.5)
* Author: minahito <sunday_lab@pleple.com> - modified by GIJOE / naao
* Purpose: cycle through given values
* Input: name = name of form 'name'
* values = preset value
* cols = default 50
* rows = default 5
* pre_style = default '' (you can specify pre_style="display:none;")
* post_sytle = default '' (you can specify post_style="display:none;")
*
* Examples: {xoopsdhtmltarea name=message cols=40 rows=6 value=$message}
* -------------------------------------------------------------
*/
function smarty_function_xoopsdhtmltarea($params, &$smarty)
{
require_once XOOPS_ROOT_PATH."/class/xoopseditor/dhtmltextarea/dhtmltextarea.php";
$form=null;
if( ! empty( $params['name'] ) ) {
$name = trim($params['name']);
$rows = isset($params['rows']) ? intval($params['rows']) : 5;
$cols = isset($params['cols']) ? intval($params['cols']) : 50;
$value = isset($params['value']) ? $params['value'] : "";
$form = new FormDhtmlTextArea( array('name'=>$name, 'value'=>$value, 'rows'=>$rows, 'cols'=> $cols) );
$rendered = $form->render();
print '<div id="'.$name.'_bbcode_buttons_pre" style="'.@$params['pre_style'].'">'.str_replace( array( '<textarea' , '</textarea><br />' ) , array( '</div><textarea' , '</textarea><div id="'.$name.'_bbcode_buttons_post" style="'.@$params['post_style'].'">' ) , $rendered ) . '</div>' ;
}
}
/* vim: set expandtab: */
?>
|