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

theme_pager and pager_query problems

I am having problems getting the pager to work correctly. Heres my code...

function viewoffers_page()
{

//Go to the unl db.
db_set_active('unl');

//Create the sql statement to find the info we want.
$sql = "select offer.offer_id as offer_id,
account.name as account_name,
form.name as form_name,
offer.name as offer_name,
offer.full_name as offer_fullname,
offer.url as offer_url,
offer.is_active as offer_is_active,
offer.is_exclusive as offer_is_exclusive,
offer.description as offer_description
from offer left outer join account on (account.account_id = offer.account_id)
left outer join form on (form.form_id = offer.form_id)";

//Set the colspan attribute.
$colspan = 1;

//Create the array of table headers.
$header = array(
array('data' => 'offer_id', 'field' => 'offer_id', 'colspan' => $colspan),
array('data' => 'account_name', 'field' => 'account_name', 'colspan' => $colspan),
array('data' => 'form_name', 'field' => 'form_name', 'colspan' => $colspan),
array('data' => 'offer_name', 'field' => 'offer_name', 'colspan' => $colspan),
array('data' => 'offer_fullname', 'field' => 'offer_fullname', 'colspan' => $colspan),
array('data' => 'offer_url', 'field' => 'offer_url', 'colspan' => $colspan),

radios

Hi,

I want to divide my radiobuttons into 2 fieldsets

in HTML it would like this:

<fieldset>
<input type="radio" name="test"... value="1">..
</fieldset>
<fieldset>
<input type="radio" name="test"... value="2">..
</fieldset>

I do not know, how to achieve this in drupal. I think somehow I should use #tree, but the use of it resulted in this

Problem inserting a new navigation menu item

Hi everyone,

I am writing a new node module and I have trying to understand how to create links under the navigation menu block.

It would appear that drupal automatically creates a link for creating a new node under "Create content -> " which appears to based on the information included in the hook_node_info(). As the user will only be permitted to create content of this new node type and unable to create any other content I would like to remove the "Create content" from the navigation menu and have a menu item for "Create " as a main navigation menu item and not as a sub menu item.

I have managed to achieve this by using the administration interface and by disabling the "Create content" menu item and its sub menu items. I then create a new menu item with the URL for my adding a new node from my new module. This is fine but I would prefer to be able to add the menu item directly from the code in my module. I have tried using the hook_menu() function (see example code below) but it would appear that whenever I set the path to node/add/dummynode drupal always insists in placing the menu item under "Create content". Can anyone suggest how I might be able to insert my new menu item for creating a new node at the top of the navigation block?

<?php
function dummynode_menu($may_cache) {
$items = array();

hook to change taxonomy form

Hi,
I've got a quick question. I've used the form_alter hook to add a textfield to the taxonomy form. What is the hook to insert the data into the database? I've tried the nodeapi and submit hooks with no luck and am running out of ideas.

TIA

crazy with db_query

Hi everybody,

i have this line of code:

       $ok=db_query("INSERT INTO {artisti} (nome, cognome, nascita, morte, descrizione) VALUES ('%s', '%s', '%s', '%s', '%s')",
	               $form_values['hmai_nome'],
                       $form_values['hmai_cognome'],
                       $n,
                       $m,
                       $form_values['hmai_descrizione']);

and it fails telling me:

Use the date element type in the form for a node

Hello everyone,

This is my first forum post although I was thinking it might be more suitable to send this message to the mailing list. Let me know if you think it is inappropriate. Anyway, I am new to Drupal and to web development for that matter but I am an experienced software developer. I have been developing my own drupal module that is an extension of a node. As part of my new node I want to add a 'date' element field value. I have created a column in my MySQL database table of type 'date' which stores the date value in a 'YYYY-MM-DD' format. In my form function I have used the form date element type to allow the user to input a date...

<?php
function hook_form($node) {
...
// Use today's date as the default value if there is no value stored
if (!isset($node->closing_date)) {
$form['closing_date'] = array(
'#type' => 'date',
'#title' => t('Closing Date'),
'#default_value' => array(
'day' => format_date(time(), 'custom', 'j'),
'month' => format_date(time(), 'custom', 'n'),
'year' => format_date(time(), 'custom', 'Y')));
} else {
// Extract the day, month and year into variables from the date
list($year, $month, $day) = sscanf($node->closing_date, "%4d-%2d-%2d");
$form['closing_date'] = array(

Pages

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