WordPress » 模块开发 imag1
 
 
你正在浏览模块开发
编辑系统模板的小工具

编辑系统模板的小工具

xoops使用smarty模板templates,完成内容和表现的分离,模板是控制表现的主要东东。我们在修改模板的时候遇到了一些麻烦,特别是系统模板。系统模板是xoops系统安装时安装的模板,如userinfo.php使用的模板,没有现成的方法更新。我们最初调试的时候使用了sql指令修改,由于是美工在修改,于是我总被打断工作去修改模板,于是我写了一个小程序来修改模板。

这个小程序被放在某个模块下,使用的时候浏览 http:// XOOPS/modules/…/tpledit.php?id=12 ,后面id就是模板的id
模板文件的数据库表是tplfile,其中tpl_file字段是模板文件名,tpl_id字段就是模板id,模板id就是传送给这个程序的参数。

/*
* Created on 2005-5-6
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/

include “../../mainfile.php”;

include XOOPS_ROOT_PATH.”/header.php”;
include_once XOOPS_ROOT_PATH.”/kernel/tplfile.php”;
include_once XOOPS_ROOT_PATH.”/class/xoopsformloader.php”;

if (!$xoopsUser) {
redirect_header(’index.php’, 3, “您没有登陆,无法访问”);
exit ();
}

if ($xoopsUser->uid() == 1) {
$tplid = 15;
if (isset ($_GET[’id’])) {

$tplid = $_GET[’id’];
}
$op = “1″;
if (isset ($_POST)) {
foreach ($_POST as $k => $v) {
${ $k } = $v;
if ($k == “update”) {
$op = 2;
}
//echo $k.” “.$v.”
“;

}
}

$tplhandle = new XoopsTplfileHandler();
$db = & Database :: getInstance();
$tplhandle->XoopsObjectHandler($db);
if (!$tpl = $tplhandle->get($tplid)) {
redirect_header(’../../index.php’, 3, “模板不存在,检查模板ID”);
exit ();
}

$tplhandle->loadSource($tpl);
$tplsource = $tpl->getVar(’tpl_source’);

//var_dump($tpl);
//echo $tplflietxt;

//echo “hi
“;
//echo $op;
if ($op == 1) {

$tplform = new XoopsThemeForm(’模板编辑’, ‘tpl edit’, ‘tpledit.php’, ‘POST’);
$tplform->addElement(new XoopsFormLabel(”tpl ID”, $tplid));
$tplform->addElement(new XoopsFormTextArea(”tpl file”, “tpl_source”, $tplsource), true);
$tplform->addElement(new XoopsFormButton(’更新’, ‘update’, ‘update’, ’submit’));

$id_hidden = new XoopsFormHidden(’tplid’, $tplid);

$tplform->addElement($id_hidden);

//$tplform->assign($xoopsTpl);

$tplform->display();
include XOOPS_ROOT_PATH.”/footer.php”;
}

if ($op == 2) {

$myts = & MyTextSanitizer :: getInstance();
$tpl_source = $myts->stripSlashesGPC(trim($tpl_source));

//echo $tpl_source;
$tpl->setVar(’tpl_source’, $tpl_source);
$tplhandle->forceUpdate($tpl);

redirect_header(”tpledit.php”, 3, ‘执行了模板的更新’);

}

include XOOPS_ROOT_PATH.”/footer.php”;

} else {

redirect_header(”../../index.php”, 30, ‘您没有权限’);

}
?>

.

xoops 开发手记

已经基于XOOPS开发了一个网站, www.etworld.cn ,自己写了一个模块,调试了2个,对xoops算入门了。
现在,第二个和第三个已经在开发中,我将慢慢的写一些心得和疑问,希望和大家共同提高。

DokuWiki添加留言讨论功能

  搞定了DOKU的ACL应用,不过你说的DOKU的留言板插件在官方没有找到,知道你这边研究DOKU一段时间了,不知道是否能够能告知是从哪里下载的,如果能直接提供插件及使用方法,实是感激不尽

更多…

DokuWiki For Xoops 的留言功能已经添加完成
演示

将在下一版本发布

注:本篇blog使用最新的Xoops plugin 插件功能发布

XPress (WordPress for Xoops) 1.52 Moon version 发布

注:
如果是全新安装Xoops请在希望完全安装完成后再安装wordpress,也就是在xoops安装的模块选择那一步不要选择wordpress
Xoops 2.22正式版以后可以在xoops安装过程中安装wordpress

Full package:
http://xoopsforge.com/uploads/xoops/xoops22_mod_wordpress_1_52_moon.zip

Upgrade from XPress 1.52:
http://xoopsforge.com/uploads/xoops/xoops22_mod_wordpress_1_52_moon_diff.zip

Changelog:

=========================================
XPress 1.5.2 (Moon)
Sep 05th, 2005

1 Removed unused template
2 Added module theme selection which allows WordPress has its own theme
3 Added user information with Xoops userinfo
4 Fixed bug in admin user data on installation
5 Added(Rollback) encoding conversion for ping, trackback and comment
6 Added module header (RSS alert)

Note:
Before Xoops 2.23 RC1, WordPress for Xoops can only be installed after the system installation is completely finished.
Since Xoops 2.23 final, it is possible to install WP during system installation as other modules, like pm, profile

==============================================
XPress 1.5.2
Aug 18, 2005

1 update WordPress to 1.5.2
2 add userinfo link for comment poster if logged on
3 add xoops decode to wp content and comment
4 remove accept-charset in form tag which is not compatible for all browsers

Thank Carnuke, Tiran_Kenja and other users for bug reports and suggestions.

Seeking comeslogist for “Article” module

This is a copy from XPress

I am seeking comeslogist(s) for my module “Article”.
“Article” is a new module that I have been working on for almost one year.

Functionalities:

  • Typical article management
  • News management
  • Personal Blog

Features:

  1. Different templates/css for each individual article and category (A new trial I have created and hope it would benefit XOOPS modules)
  2. Cross-category
  3. Topic (Or special series)
  4. True multi-pages (no length limit for an article, another new feature I have created)
  5. Different level of edit forms
  6. Different article status (from created, personal, submitted, registered, published to featured)
  7. Keywords bridging
  8. Headings/Notes auto-generation
  9. Pingback/trackback

More features will be disclosed with public release.

If you have interest and to serve as “Article Comeslogist”, plz send me message or leave a comment here.
Note: There is no count limit on comeslogists since the “Article” has the capability to use various templates and CSSes on-fly.
Once your design is accepted, I would invite you as a co-author of the “Article”.

Dev status:

  • The coding part has been finished.
  • Xoops internal bridging system is being developed, partially implemented in the “Article”.
  • A default set of template/css created by myself, fully-CSS driven, but the skin is not beautiful.
  • Multi-user blog system, which is based on the “Article”, has been proposed.