Drupal progress bar

Source: Internet
Author: User
Tags php source code drupal

Introduction: This is a detailed page of The Drupal progress bar. It introduces the knowledge, skills, experience, and some PHP Source Code related to PhP.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 340018 'rolling = 'no'>

Drupal has a built-in batch tool with a percentage progress bar showing the operation progress.

The usage is as follows:

Batch_set (batch_example_batch_1 ());

Batch_process ('redirect _ page. php ');

Function batch_example_batch_1 (){

For ($ I = 0; I 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 );

}

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/340018.html pageno: 7.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.