Related Poll block based on current taxonomy

It took me quite a while to figure out that $node-nid does not get populated in a php block... Wow! Ok so I'm learning as I go and the framework is not as simple as it may appear. There are some catches that must be learned 1st, all good..

What I am triing to do is make a block that has php code in it that will display a Poll that has the same taxonomy term as the current node being viewed. For instance both the page node and poll have a term associated in the same vocabulary:
*Page & Poll categorized as = term1

I have placed this code chunk in a PHP custom block which I ripped from the core Poll module and trying to display a related poll. I have tried various renditions but the most I can get out of it is "Array" I do know how to use PHP but I'm very unfamiliar with Drupal's framework.

I have tried using taxonomy_node_get_terms_by_vocabulary and other methods to work with the array that is returned but I just can't figure it out.

Can someone please help.


<?php

// Retrieve the latest poll.
if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
$nid = (int)arg(1);
$tids = array();
foreach(taxonomy_node_get_terms($nid) as $term) {
$tids[] = $term->tid;
}

if ($tids) {
$terms= implode(',', $tids);
}

request for the forum labels...

just a request... is there a way that we can add to the thread label which version of drupal we are talking about. I notice this about the tutorials. It is sometimes confusing when we are reviewing something only to find out that it is an older version. perhaps even having a drupal 6 ONLY site. I would spend more time there. perhaps even make some contributions.

vince

No menu visible for anonymous users

I have been tinkering around with this for a day and am at my wits end.

Autocomplete with extra JSON object?

Hi, I am writing a Drupal module for simple browser-based video editing. A user types a phrase into an textfield form element, which performs an autocomplete search to a table in the database for similar phrases. This part is easy, thanks to Drupal. But the hard part is that I need a second piece of information simultaneously extracted from the matched row in the database: The url to the media file.

My db structure:
The module creates table "colingo_media" with fields "title", "url", etc.

The issue wireframed:
1) I type "my name is p" into an autocomplete textfield.
2) The db is queried to look for all rows with title "my name is p" and returns "my name is phil" as the only possible match.
3) The user clicks on "my name is phil".

At this point, the URL for the matched row with title "my name is phil" needs to be returned to jQuery, where I'll add it as an attribute to the form element.

my precise question

How can I return multiple objects within the Drupal autocomplete framework, one as the item to be autocompleted, and the other as a hidden jQuery object?

the code i'm working with:
function colingo_autocomplete($string = '') {
$matches = array();
if ($string) {
$result = db_query_range("SELECT title FROM {colingo_media} WHERE LOWER(title) LIKE LOWER('%s%%')", $string, 0, 10);

File upload for Page Attachment giving error

Just done a fresh install of D6 on some siteground space and it's all running fairly well except when I try to attach any file to a new page - when I click Attach the file is uploaded and then an alert comes up saying "An HTTP error 0 occurred\n/cms/upload/js". The file is uploaded and finds its way into the /sites/default/files directory OK (as per the config in "administer"). Any ideas why?

Also is this the only/main way to get files uploaded in D6 if I want to embed IMG SRC links in page content?

RB

Hmm Seems I'm not the first to ask this question but very little info on solutions!

Hi Folks,

Just starting developing with a drupal 6 project and almost immedietly hit a brick wall. I've researched the posts on similar issues but they have been of no help. So here it is....I wonder if I will get zero replies like so many similar posts I have read.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 6.x