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

dropdown menu

how to create dropdown menu in any theme

dropdown menu for taxonomy

i have created the categories using taxonomy, i want to make menu for those catefories.

menu must be dropdown menu.

i.e.

technologies
-java
-vb

Code Clean up using node_import module

I'm seeking help from those can help me out with this. I'm migrating from my current MySQL database to drupal's MySQL. However, in my current mysql db it contains codes like <br>, &, <p> and etc which are not a XHTML way of coding. Because currently I'm designing the new site which need to be a "Valid XHTML 1.0 Strict". I couldn't just import the improper code to the new XHTML 1.0 Strict's website as it wouldn't be XHTML Strict anymore.

If I'm not mistaken, I've to use the str_replace() function to do the replacing but I don't know where should I insert it to.

I guess should be around this area around line 759.

 /**
 * Get one row from the CSV file and return it as an array of
 * columns/fields.
 */
function _node_import_csv_get_row($filepath, $reset = FALSE) {
  static $handle;
  $size = variable_get('node_import_csv_size', 10000);
  $separator = variable_get('node_import_csv_separator', ',');

  if ($filepath == '') {
    unset($handle);
    return FALSE;
  }

  if (!isset($handle) || $reset) {
    if (isset($handle)) {
      fclose($handle);
    }
    $handle = fopen($filepath, 'r');
		
  }
  return fgetcsv($handle, $size, $separator);
}

I hope I can get the code clean up using the node_import module so I won't need to manually replacing the codes by hands.

Can some developers

Create a block with this code

Hi !
I'd like to create a block with this code but I get an error message related to the Drupal code eval or something like that...

Could you tell me what's wrong with it ?


<?
require("http://radioanda.org/play/config.php");

$db->open("SELECT songlist.*, historylist.listeners as listeners, historylist.requestID as requestID, historylist.date_played as starttime FROM historylist,songlist WHERE (historylist.songID = songlist.ID) AND (songlist.songtype='S') ORDER BY historylist.date_played DESC",6);
$history = $db->rows();
reset($history);

$db->open("SELECT songlist.*, queuelist.requestID as requestID FROM queuelist, songlist WHERE (queuelist.songID = songlist.ID) AND (songlist.songtype='S') AND (songlist.artist <> '') ORDER BY queuelist.sortID ASC",2);
$queue = $db->rows();
reset($queue);

//### Calculate the bezt time to refresh the webpage in order to show new updated song information
//==================================================================================================
list($key, $song) = each($history);
$listeners = $song["listeners"];

$starttime = strtotime($song["date_played"]);
$curtime = time();
$timeleft = $starttime+round($song["duration"]/1000)-$curtime;

//Set refesh interval
if($timeleft>0) # 30 second minimum wait
{ $timeout = $timeleft;} # if timeleft is valid, refresh on timeleft (should be end of song)
else
{ $timeout = 90; } # otherwise, fall back on 90 second refresh

if(($timeout>180) or ($timeout==0)) $timeout = 180;
if($timeout<30) $timeout = 30;

$refreshURL = "index.php?buster=".date('dhis').rand(1,1000);
//==================================================================================================

$pic_cnt = 0;
function PicName()
{
global $pic_cnt;
echo "Picture".$pic_cnt;
}

function NextPicName()
{
global $pic_cnt;
$pic_cnt += 1;
PicName();
}

function PutSongRow(&$song)
{
global $rc, $showpic, $darkrow, $lightrow;
PrepareSong($song);

$rc++;
$bgcolor = $darkrow;
if(($rc % 2)==0) $bgcolor = $lightrow;

?>

<?echo $song["artist"]; ?>

<? echo $song["title"]; ?>

<?if($showpic){?>
<? if($song["haspicture"]) {?>
Only local images are allowed." onError="PictureFail('<? PicName(); ?>')" src="<? echo $song["picture"]; ?>" alt="Cliquez sur cette image pour écouter Anda.">
<?};?>
<?}?> En ce moment sur Anda, on écoute
<?if(!$showpic) echo "colspan=2"?> <? echo $song["title"]; echo " par "; echo $song["artist"]; ?>.
Cliquez ici pour lancer la lecture et rejoindre les autres auditeurs.

New profile.module number field giving me fits in the views module

Description

I've made an additional field in the profile.module to enter and validate numbers (something I *can't* wait to submit - hopefully to be adopted quickly). But, before that I wanted it to play nice with the views.module.

The profile.module stores its information using an EAV data model - therefore my numbers are being stored as text in the database. To make the numbers sort correctly they will need to be converted from text into numbers in the SQL statement...

I've discovered that MySQL 4.1 doesn't support CAST very well (there is no CAST AS DECIMAL), but you can trick MySQL into the conversion by adding 0 to the text value and MySQL will convert on the fly:

This statement will sort the numbers stored as text correctly:
SELECT value FROM {profile_values} WHERE fid = %d ORDER BY (value + 0) DESC

as opposed to:
SELECT value FROM {profile_values} WHERE fid = %d ORDER BY value DESC

So, I'm stuck with the specific question:
How do you write a views handler that changes 'value' to '(value +0)' ?

I've got this far:
<?php
function views_handler_filter_profile_number($op, $filter, $filterinfo, &$query) {

switch ($op) {
case 'handler':
$table = 'profile_value';
$column = 'value';
$query->ensure_table($table);
$field = "$table.$column";

$operator = $filter['operator'];
$where = "(%s + 0) $operator %s";

Extended characters (as select options in a form)

I'm implementing the hook_form() in a module and need to pass some special characters as options to a select box.

Special characters like & are converted to it's "name code" (&amp;) while characters like pund sign (£) or one-half (½) are not.

Since & is converted I can't pass the name-code for the special characters.

If anyone knows how I can get those special characters to appear in the select list I would highly appreciate the help.

Pages

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