Tự xây dựng trang tham khảo Drupal API

@Cập nhật

Drupal là một php framework tốt. Tuy nhiên, khi dựa trên nó để viết các module người lập trình phải vào http://api.drupal.org để tra cứu các hàm, các thí dụ mẫu. Trường hợp, máy tính của mạng không nối mạng, hoặc mạng chậm, hoặc A.D.O có trở ngại thì công việc sẽ bị ngưng trệ. Bài viết này hướng dẫn bạn tự xây dựng một trang tham khải Drupal API.

Tham khảo: http://drupal.org/node/26669

Cài đặt Drupal

Trang tham khảo này chắc chắn được xây dựng dựa trên một website Drupal. Do đó, trước hết bạn hãy cài đặt một bản Drupal. Giả sử bạn sẽ cài đặt ở http://localhost/drupal_api/

Chuẩn bị các files

  1. Tải về module API (đổi đuôi lại thành .zip) và copy vào folder /drupal_api/modules/
  2. Tải về file docs.zip (đổi đuôi lại thành .zip), giải nén và copy vào folder /drupal_api/

Kích hoạt module

Vì bản cài đặt này chúng ta chỉ dùng để tham khảo drupal API, nên chúng ta không bật các module nào khác ngoài 'api'. Sau khi kích hoạt module API, module sẽ cung câp cho chúng ta một menu item ở 'Admin > Content Management > API reference'.

Đánh chỉ mục

  1. Vào trang 'Admin > Content Management > API reference' (?q=admin/content/api).
  2. Ở mục 'Short name', nhập vào '5.x'.
  3. Ở mục 'Long name', nhập vào 'Drupal 5.x'.
  4. Ở mục 'Directory Name', nhập vào './'.
  5. Ở mục 'Maximun files to scan per cron run', chọn '200'.
  6. Click vào nút 'Save changes'
  7. Chạy cron khoảng 10 lần (Ở trình duyệt, nhập vào http://localhost/drupal_api/cron.php, khi chạy xong thì refresh lại, làm lại khoảng 10 lần).

Sử dụng

  1. Vào trang điều hành blocks, cấu hình block API theo ý thích
  2. Vào trang http://localhost/api/?q=api, bạn đã có một trang tham khảo tương tự drupal API.

Comments

Lợi hại quá

Chỉ còn biết nói có 1 câu:"Phục bác sát đất"!!!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <sup> <br> <p> <h3>
  • Lines and paragraphs break automatically.
  • Link to content with [[some text]], where "some text" is the title of existing content or the title of a new piece of content to create. You can also link text to a different title by using [[link to this title|show this text]]. Link to outside URLs with [[http://www.example.com|some text]], or even [[http://www.example.com]].
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.