现在的位置: 首页 > 综合 > 正文

Drupal进度条

2012年06月06日 ⁄ 综合 ⁄ 共 1300字 ⁄ 字号 评论关闭

简介:这是Drupal进度条的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=340018' scrolling='no'>

Drupal有一个内置的百分比进度条显示操作进度的工具batch.

使用方式如下:

batch_set(batch_example_batch_1());

batch_process('redirect_page.php');

function batch_example_batch_1() {

    for ($i = 0; $i<100; $i++) {
        $operations[] = array('batch_example_op_1', array($nid));
    }
    $batch = array(
            'operations' => $operations,
            'finished' => 'batch_example_finished',
    );
    return $batch;
}

function batch_example_op_1($nid, &$context) {

    do_something();

    // Store some result for post-processing in the finished callback.
    $context['results'][] = "do something";

    // Optional message displayed under the progressbar.
    $context['message'] = t('Loading @title', array('@title' => $node->title));

}

function batch_example_finished($success, $results, $operations) {
    if ($success) {
        $message = count($results) . ' processed.';
    }
    else {
        $error_operation = reset($operations);
        $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
    }
    drupal_set_message($message);

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/340018.html pageNo:7

抱歉!评论已关闭.