11
Mithrandir
Re: Blocks

no php debug messages?

12
Coplan
Re: Blocks
  • 2004/4/13 20:00

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


None.

Viewsource reveals:

Quote:

<html>
</html>


I'm going to rip out the block file and start from scratch to see what happens. I've gone over the code several times now. It must be a punctuation thing or something. I'll keep you in the loop.

13
worlds
Re: Blocks
  • 2004/4/14 19:21

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Quote:
I've gone over the code several times now. It must be a punctuation thing or something.


Have you tried just running PHP from the command line? I do that to catch my punctuation errors. Which I make a lot of.

php -f blockxxx.php

Also check your included files.

If you post the code, it's easier to help.

BTW, For some reason, I don't see as many syntax errors in my XOOPS code, as I get from pure PHP (admittedly on a different machine).

Is there some PHP/modPHP setting I should change to enable all errors? Or is it just a "xoops thing"?

Thanks,

Tom


14
Coplan
Re: Blocks
  • 2004/4/15 3:31

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


Alright...I can't seem to figure it out. Here's the source code for my file:

<?php
/*****************************************************************************
    Tune Tracker Database
    Written Exclusively For: SceneSpot.org
    By:  D. Travis "Coplan" North
    
******************************************************************************/
include_once(XOOPS_ROOT_PATH.'/modules/tunetracker/system.php');

function 
b_tunetracker_current_tunes() {
  global 
$xoopsDB$tt_sinfo$tt_users$tt_songs;

  
// This part is temporary until I get include working
  
$tt_users   $xoopsDB->prefix("users");
  
$tt_sinfo   $xoopsDB->prefix("tt_sinfo");
  
$tt_songs   $xoopsDB->prefix("tt_songs");

  
$block = array();

  
$sth $xoopsDB->query('SELECT *, DATE_FORMAT(s_date, "%b %d %Y") as f_date FROM '.$tt_sinfo.' ORDER BY s_date DESC LIMIT 8') or die (mysql_error());
  
  
$cnt 0;
  while (
$row $xoopsDB->fetchArray($sth)) {
    
$block['tunes'][$cnt]['url'] = XOOPS_URL.'/modules/tunetracker/viewsong.php?id='.$row[sinfo_id];
    
$block['tunes'][$cnt]['s_name'] = $row[s_name];
    
$block['tunes'][$cnt]['date'] = $row[f_date];

    
$a_sth$xoopsDB->query('SELECT uname FROM '.$tt_songs.' LEFT JOIN '
                       
.$tt_users.' ON '.$tt_songs.'.user_id='.$tt_users
                       
.'.uid WHERE sinfo_id="'.$row[sinfo_id]
                       .
'" ORDER BY uname') or die (mysql_error());

    
$ac 0;
    while (
$arow $xoopsDB->fetchArray($a_sth)) {
      if (
$ac >= 1) { $block['tunes'][$cnt]['artist'] .= ', '; }
      
$block['tunes'][$cnt]['artist'] .= $arow[uname];
    
      
$ac++;
    }
  
    
$cnt++;
  }

  return 
$block;
}


?>


system.php has a bunch of subroutines and definitions that I need (such as $tt_sinfo, etc). You'll notice I had to put a little tidbit in there until I can get this file included.

Also....
I discovered another symptom along the way. I can include files from other modules -- just not my module. Anything from this module gets spit out as a blank page containing only "<html><body></body></html>" and nothing more. And it doesn't matter what file I try to include. I checked my directory settings, and everything seems to be okay. Anyone have any more ideas as to why I can't include files in my block?

As always, i appreciate the help.

15
Dave_L
Re: Blocks
  • 2004/4/15 3:52

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Try printing out $block at the end of that function:

[color=ff0000]var_dump('in b_tunetracker_current_tunes, block='$block);[/color]
  return 
$block;
}

?>

16
Coplan
Re: Blocks
  • 2004/5/12 4:24

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


Sorry, I was stuck for a while as my server crashed. Now that it's back in order, I set about trying to figure this out.

I hate to do this, but I'm really REALLY stumped. I'm going to post the two files as they are right now. Then I'll post the error messages I get:

First: ./modules/tunetracker/blocks/tt_blocks.php
<?php
/*****************************************************************************
        Tune Tracker Database
        Written For: SceneSpot.org
        By:  D. Travis "Coplan" North
******************************************************************************/
include_once('../../../mainfile.php');
include_once(
'../system.php');

function 
b_tunetracker_current_tunes() {
  global 
$xoopsDB$tt_sinfo$tt_users$tt_songs;

  
// I get errors if I remove these lines, as if they aren't defined.
  
$tt_users   $xoopsDB->prefix("users");
  
$tt_sinfo   $xoopsDB->prefix("tt_sinfo");
  
$tt_songs   $xoopsDB->prefix("tt_songs");

  
$block = array();

  
$sth $xoopsDB->query('SELECT *, DATE_FORMAT(s_date, "%b %d %Y") as f_date FROM '.$tt_sinfo.' ORDER BY s_date DESC LIMIT 8') or die (mysql_error());
  
  
$cnt 0;
  while (
$row $xoopsDB->fetchArray($sth)) {
    
$block['tunes'][$cnt]['url'] = XOOPS_URL.'/modules/tunetracker/viewsong.php?id='.$row[sinfo_id];
    
$block['tunes'][$cnt]['s_name'] = $row[s_name];
    
$block['tunes'][$cnt]['date'] = $row[f_date];

    
$a_sth$xoopsDB->query('SELECT uname FROM '.$tt_songs.' LEFT JOIN '
                                           
.$tt_users.' ON '.$tt_songs.'.user_id='.$tt_users
                                           
.'.uid WHERE sinfo_id="'.$row[sinfo_id]
                                           .
'" ORDER BY uname') or die (mysql_error());

    
$ac 0;
    while (
$arow $xoopsDB->fetchArray($a_sth)) {
      if (
$ac >= 1) { $block['tunes'][$cnt]['artist'] .= ', '; }
      
$block['tunes'][$cnt]['artist'] .= $arow[uname];
    
      
$ac++;
    }
  
    
$cnt++;
  }
  return 
$block;
}


?>


Next: ./modules/tunetracker/system.php

<?php
/*****************************************************************************
 *      Tune Tracker Database
 *      Written Exclusively For: SceneSpot.org
 *      By:  D. Travis "Coplan" North
 *
 *   Configuration files needed by a couple of different scripts 
******************************************************************************/

// Get module ID (used for admin checks, etc)
$mid $xoopsModule->mid();

// Beta Message -- uncomment for beta
$beta = <<<END_QUOTE
<b><em>
Please note that this is a beta release of Tune Tracker.  This is for testing
only.  Any entry added may or may not be saved for future use on the official
SceneSpot website.
</em></b>

END_QUOTE;

// Set the Tables Needed:
$tt_users   $xoopsDB->prefix("users");                                          
$tt_guests  $xoopsDB->prefix("tt_guests");                                    
$tt_sinfo   $xoopsDB->prefix("tt_sinfo");                                     
$tt_songs   $xoopsDB->prefix("tt_songs");                                     
$tt_genre   $xoopsDB->prefix("tt_genre");                                     
$tt_sgenres $xoopsDB->prefix("tt_sgenres");                                   
$tt_type    $xoopsDB->prefix("tt_type");      
$tt_files   $xoopsDB->prefix("tt_files");      
$tt_options $xoopsDB->prefix("tt_options");
$tt_votes   $xoopsDB->prefix("tt_votes");
$tt_dlcnt   $xoopsDB->prefix("tt_dlcnt");

?>


As you can see, the system.php file defines all those table names. That is the real reason why I want to call them into my blocks script. However, if I comment out the lines indicated in tt_blocks.php (3 lines, starting $tt_...), I get error messages from mySQL as if the table names weren't defined.

If I run 'php tt_blocks.php' at the command prompt, I get no errors.

Does anyone have any thoughts as to what the problem might be? I really want to get this figured out.

17
Dave_L
Re: Blocks
  • 2004/5/12 8:09

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Did you try my previous suggestion?

18
Coplan
Re: Blocks
  • 2004/5/12 12:01

  • Coplan

  • Just popping in

  • Posts: 51

  • Since: 2002/10/2


I did, and didn't notice any difference.

What was supposed to happen?

19
Dave_L
Re: Blocks
  • 2004/5/12 14:04

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


It prints out the contents of the $block array. You should have gotten some output from the var_dump(), even if $block is empty or undefined. Is PHP debug on?

20
worlds
Re: Blocks
  • 2004/5/12 21:10

  • worlds

  • Just popping in

  • Posts: 61

  • Since: 2004/3/13


Hi -

If you want to post a link to a zip with the whole module, people can install it, and see what's up.

But flying blind (with only parts of the module definition), there's not much we can do but guess.

Tom

Login

Who's Online

242 user(s) are online (155 user(s) are browsing Support Forums)


Members: 0


Guests: 242


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits