1
I have a problem when hack the article module.
Below is detail:
I add a block , It is only a simple block.
but when I update the module of article,
the first page of the website went to a blank--yes, blank, no error.
I want to know why the fist page of the website went to blank?
If I have got some mistakes , I want to know the error message. How can I get the error message?
And below is all the scripts I add.
1) xoops_version.php
add some scripts:
$modversion["blocks"][] = array(
"file" => "show_by_you.php",
"name" => art_constant("MI_BY_YOU"),
"description" => art_constant("MI_BY_YOU"),
"show_func" => $GLOBALS["ART_VAR_PREFIX"]."_article_show",
"options" => "10", // MaxItems
"edit_func" => $GLOBALS["ART_VAR_PREFIX"]."_article_edit",
"template" => $GLOBALS["artdirname"]."_block_by_you.html");2)show_by_you.php:
/**
* Article management
*
* @copyright The XOOPS project https://xoops.org/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author Shurong Yin (xxpyeippx or surance)
* @since 1.00
* @version $Id$
* @package module::article
*/
if (!defined('XOOPS_ROOT_PATH')){ exit(); }
include dirname(dirname(__FILE__))."/include/vars.php";
mod_loadFunctions("parse", $GLOBALS["artdirname"]);
/**
* Functions handling module blocks
* @package module::article
*
* @author Surance (xxpyeippx)
* @copyright copyright © 2000 The XOOPS Project
*
* @param VAR_PREFIX variable prefix for the function name
*/
art_parse_function(
/**#@+
* Function to display articles
*
* {@link article}
* {@link xcategory}
* {@link permission}
* {@link config}
*
* @param array $options:
* 0 - maxlines
*/
function [VAR_PREFIX]_article_show($options)
{
global $xoopsDB;
$block = array();
$artConfig = art_load_config();
art_define_url_delimiter();
$query = "select A.art_id,A.art_title,A.art_time_publish,A.cat_id,C.cat_title as category from `xoops_ch__art_article` as A".
"inner join `xoops_ch__art_category` as C".
"on A.cat_id=C.`cat_id`".
"where A.cat_id=9";
$result = $xoopsDB->query($query, $options[0], 0);
if (!$result) {
xoops_error($xoopsDB->error());
// return $block;
}
while ($row = $xoopsDB->fetchArray($result)) {
$rows[] = $row;
}
foreach ($rows as $row) {
$block["articles"][] = array( "id"=>$row["art_id"], "title"=>$row["art_title"], "category"=>$row["category"]);
}
$block["dirname"] = $GLOBALS["artdirname"];
return $block;
}
function [VAR_PREFIX]_article_edit($options)
{
$form = art_constant("MB_ITEMS")."
";
return $form;
}
/**#@-*/
?>3)article_block_by_you.html:
<{foreachq item=article from=$block.articles}>
<{/foreach}>