This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

cck item positioning

I'm a new drupaller who is running 5 rc2. I just installed cck and I am trying to figure out how to position cck's output in my node. I want to place it before my story's title, not after, which it seems to by default. I'm trying to use it to place a different image next to my titles depending on the item type I choose (so if anyone knows a better way to do that as well please let me know). I'm not exactly a php master so please dumb it down a little. Thanks in advance.

Need help! Comment form doesn't appear

So I've been working with drupal for a while now, and things have been going great with it until I decided I wanted to allow people to post comments. The post comment form appears for all nodes except the nodes that I have made. This is almost certainly a result of me not programming well, but I can't figure out what I did wrong and would love any help/comments/feedback possible. The code for the module is as such (its for people to submit 'rants')


/**
* Implementation of hook_help().
*/
function rants_help($section) {
switch ($section) {
case 'admin/help#rants':
$output = '

'. t('The Rants module allows users to submit items for the Rants section. ') .'

';
$output .= '

'. t('The Rants module.') .'

';
$output .= t('

You can do stuff

', array('%node-add-rants' => url('node/add/rants'), '%admin-settings-content-types-rants' => url('admin/settings/content-types/rants')));
return $output;
case 'admin/modules#description':
return t('Allows users to submit Rants item');
case 'node/add#rants':
return t('Rants items are rant body and the person who wrote the rant.');
}
}

/**
* Implementation of hook_node_info().
*/
function rants_node_info() {
return array('rants' => array('name' => t('Rants'), 'base' => 'rants'));
}

/**
* Implementation of hook_perm().
*/
function rants_perm() {
return array('create Rants', 'edit own Rants');
}

/**
* Implementation of hook_access().
*/
function rants_access($op, $node) {
global $user;

if ($op == 'create') {
return user_access('create rants');
}

if ($op == 'update' || $op == 'delete') {
if (user_access('edit own Rants') && ($user->uid == $node->uid)) {
return TRUE;
}
}
}

function rants_nodeapi(&$node, $op, $arg = 0){
}

/**
* Implementation of hook_menu().
*/
function rants_menu($may_cache) {
$items = array();

if ($may_cache) {
$items[] = array('path' => 'node/add/rants', 'title' => t('Rants'),
'access' => user_access('create Rants'));
}

return $items;
}

/**
* Implementation of hook_form().
*/
function rants_form(&$node) {
$form['title'] = array('#type'=>'textfield', '#title'=>t('Headline'), '#required'=>TRUE,'#default_value'=> $node->title,'#rows' => 1);
$form['ranter'] = array('#type'=>'textfield','#title'=>t('Author'), '#required'=>TRUE,'#default_value'=>$node->ranter,'#rows'=>1);
$form['introtext'] = array('#type'=>'textarea','#title'=>t('Introduction Text (optional)'), '#required'=>FALSE,'#default_value'=>$node->introtext,'#rows'=>20);
$form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('Rant'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
$form['body_filter']['format'] = filter_form($node->format);
return $form;
}

function rants_insert($node) {
db_query("INSERT INTO rants (nid,ranter,rant,introtext) VALUES (%d,'%s','%s','%s')",$node->nid,$node->ranter,$node->body,$node->introtext);

}

function rants_update($node) {

if ($node->revison){
overheard_insert($node);
}
else {
db_query("UPDATE rants SET ranter ='%s', rant = '%s', introtext = '%s' WHERE nid = %d",$node->ranter,$node->rant,$node->introtext,$node->nid);
}
}

function rants_delete($node) {
db_query("DELETE FROM rants WHERE nid= %d",$node->nid);
}

function rants_load($node) {
$additions = db_fetch_object(db_query("SELECT node.created, rants.ranter,rants.rant,rants.introtext FROM rants JOIN node ON node.nid = rants.nid WHERE rants.nid = %d",$node->nid));
return $additions;
}

function rants_view(&$node, $teaser = FALSE, $page = FALSE) {

//$node = node_prepare($node, $teaser);
$test = theme('rants_content',$node);

}

function theme_rants_content($node){

$output .= "

";
$output .= "

B-Rant

";

if ($node->ranter != '')
$output .= "

- submitted by ".$node->ranter." on ".format_date($node->created,'custom','m/d/Y')."

";
else
$output .= "

- added on: ".format_date($node->created,'custom','m/d/Y')."

";

$output .= "
".$node->title."

";

$output .= "

".$node->body."

Views module,May customising the new user list?

Views module,May customising the new user list?

I need according to user's ID arrangement.

Thanks

ERP

Hi Guys

Is it possible to use the erp module to display products on the front-end of a website and then sell the products as well. Basically I would like to use the erp as the sole module to handle the stock control, sales, customers etc.

Many thanks.

Rich

CCK dynamic (multiple) field keyed on taxonomy

I'm trying to put together a CCK field that "creates" a nodereference field based on taxonomy. For example, for a taxonomy with terms A, B, C, D and a node assigned terms B and D: the node edit form will display two fields "B nodereference" and "D nodereference." hope that is remotely clear. i am just adjusting code from nodereference.module to create this new field.

CCK dynamic (multiple) field keyed on taxonomy

I'm trying to put together a CCK field that "creates" a nodereference field based on taxonomy. For example, for a taxonomy with terms A, B, C, D and a node assigned terms B and D: the node edit form will display two fields "B nodereference" and "D nodereference." hope that is remotely clear. i am just adjusting code from nodereference.module to create this new field.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions