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

AJAX form_autocomplete problem

Hi,

I was trying to use the form_autocomplete functionality, however I got some problems. I have downloaded the latest drupal HEAD version.

When I for example user the already included user/autocomplete everything works fine:

function _messenger_addressbook() {
$output = '

Messenger! Addressbook

';

$author = form_autocomplete(t('Username'), 'user', '', 30, 60, 'user/autocomplete', NULL, NULL, TRUE);
$form = form($author);
$output .= $form;

print theme("page", $output);
}

But when I try to do this myself there is something wrong:

function messenger_menu($may_cache) {
global $user;

$items = array();
$view_access = user_access('access messenger');

if (!$may_cache) {
$items[] = array('path' => 'messenger/user_autocomplete',
'title' => t('messenger user autocomplete'),
'callback' => 'messenger_user_autocomplete',
'access' => $view_access,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'messenger/compose',
'title' => t('compose message'),
'callback' => '_messenger_compose',
'access' => $view_access,
'type' => MENU_NORMAL_ITEM,
'weight' => 4);
...
}
return $items;
}

function _messenger_compose() {
$output = '

Messenger! Compose message

recursive functions

could anyone point me in the right direction for a way to find the number of nodes in a taxonomy term, as well as all of the child nodes underneath it?

recursive functions aren't a strong point of mine, so any resources, pseudo code, etc would greatly help

thanks

what am i doing wrong?

<?php

function taxonomytree_menu() {
	$items = array();
	if($may_cache) {
		$items[] = array(
			'path' => 'taxonomytree',
			'title' => t('taxonomy tree'),
			'callback' => '_taxonomytree_page',
			'access' => user_access('access content'),
			'type' => MENU_CALLBACK
		);
	}	
	return $items;
}

/*
	Function to give drupal information about the module
*/
function taxonomytree_help($section='') {
	$output = '';
	switch($section) {
		case "admin/modules#description":
			$output = t('Displays a taxonomy tree for vocabularies with current nodes underneath');
			break;
	}
	
	return $output;
}

/*
	Return permissions for the module
*/
function taxonomytree_perm() {
	return array('access taxonomytree');
}

/*
	Return settings HTML or deny access
*/
function taxonomytree_settings() {
	if(!user_access('admin taxonomytree')) {
		return message_access();
	}
	$output = form_textfield(t('Maximum number of links'), 'taxonomytree_maxdisp', variable_get('taxonomytree_maxdisp', '25'), 2, 2, t('The maximum number of links to display per page.'));
	return $output;
}

/*
	Page content for taxonomytree
*/
function _taxonomytree_page() {
	$output = 'this is where the content for the taxonomy tree module will go');
	return $output;
}
?>

when i go to the url of my new module that i am working on, it says that the page cannot be displayed.

Need help with module development. Will pay!

I have been asked to work on a project in which users can search a database, much like Google by asking questions. Such as, "where can I get my computer fixed?" Then it will display a list of links with contact information on local computer businesses much like the yellow pages. The database will be composed of paying and non-paying subscribers. Paying subscribers need to be listed first and upon clicking their link it should display more information including a video or flash advertisement. Preferrably clients could login and edit their information.

Adding Search To the Aggregator

I had simple code that previously worked for adding search capabilities to the aggregator. That code no longer works with the 4.6 upgrade. Can someone help me implement it or point me in the right direction to do so? Note - I do not want to use the module that allows you to import your aggregator posts to full node posts.

Thanks in advance.

session variables disappear?

The carto module has to make several calls to external php scripts that use $_SESSION to 'remember' some variables. The external php scripts by themselves work well, but when called from Drupal it seems that the session variable looses its value.
Is this 'problem' of Drupal familiar to anyone and is there a known solution?

Thanks,
John.

Pages

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