Tập viết module

Chào các bạn. Mình mới tập viết một module đơn giản. Module lớp. Trong đó có một field mình muốn sài thuộc tính datepick của cck được ko?

Comments

Không hiểu tại sao cái module

Không hiểu tại sao cái module của mình viết sài được rồi. Loay hoay tới hôm nay nó lại ko có tác dụng gì với phân quyền hết (ko sửa được). Mặc dù mình đã set permission cho user toàn quyền node type đó. Không hiểu lý do tại sao luôn. Hic. Code hook perm và hook access thế này không biết có vấn đề gì ko, mong các bạn giúp đỡ!

<?php
function center_perm() {
  return array(
    
'create center content',
    
'delete any center content',
    
'edit own center content',
    
'edit any center content',
  );
}
function 
center_access($op$node$account) {
  if (
$op == 'create') {
    return 
user_access('create center content'$account);
  }
  if (
$op == 'update') {
    if (
user_access('edit any center content'$account) || (user_access('edit own center content'$account) && ($account->uid == $node->uid))) {
      return 
TRUE;
    }
  }

  if (
$op == 'delete') {
    if (
user_access('delete any center content'$account)) {
      return 
TRUE;
    }
  }
}
?>

Bạn có thể định nghĩa một

Bạn có thể định nghĩa một node type, sau đó bật CCK module, rồi add field vào content type mà bạn đã định nghĩa. Có thể tham khảo cách tạo một node type tại đây.

Thế Hồng

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.