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

Display search result in main page

Hi all,

I am trying to build a module that queries the site using Google, and displays the search result within the main page. I have tried to

fopen($url,'r') // Store query result in $result
...
print theme('page',$result)

but it the entire "Google search" block disappears, and the results get displayed twice (once above the theme, but also inside the main page, as desired).

Thanks in advance,
Olivier

Local task item path misbehaving

For a group of local task items I have a default item with a path as 'whalemail/addressbook/index' and yet when drupal renders the page it just uses a path of 'whalemail/addressbook'... WHY?!!! This is driving me nuts.

A module installed in 'sites/example.com/modules' should override the same module installed in the main 'modules' directory.

With multi-site set ups, it is possible to add a module to a single site by installing it in 'sites/example.com/modules'. This works as expected. By this same logic, I shouldn't I be able to override existing system-wide(shared) modules in the same way?

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.

Pages

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