MS-Analysis1.php - need a little help with this block please

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   MS-Analysis1.php - need a little help with this block please
Mindvacant
CZ Newbie
Mindvacant has been a member for over 20 year's 20 Year Member
Website:
Status: Offline
Joined: Dec 25, 2003
0.00 posts per day
Posts: 22
Points: 1,942
   
Hi,

I've been trying to create a scrolling block based on MS-Analysis1.php (the block that displays the countries).

I have it working, but can't get the FLAGS to display - sure I'm missing something really stupid, but I can't see it.

Here's the block:

<<< Begin block >>>
<?php
$maxshow = 24; // # of Countries

if (eregi("block-ScrollCountries.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

global $prefix, $db;
$show = "";
$a = 1;
$result = $db->sql_query( "select domain, description, hits from $prefix"._msanalysis_countries." order by hits DESC LIMIT 0,$maxshow");
$flag = "modules/$module_name/images/flags/$domain".".gif";
while(list($lid, $title, $hits, $flag) = $db->sql_fetchrow($result)) {
$title2 = ereg_replace("_", " ", $title);
$show .= "$domain$title2</a><br> Visits $hits<br>";
//$show .="$flag".".gif";
$a++;
}
$content = "<A name= \"scrollingCountries\"></A>\n";
$content .= "<MARQUEE behavior= \"scroll\" align=\"right\" direction= \"down\" height=\"320\" scrollamount= \"3\" scrolldelay= \"90\" onmouseover='this.stop()' onmouseout='this.start()'>\n";
$content .= "$show";
$content .= "</marquee>\n";


?>

<<< end block >>>>

If someone could take a peek and maybe get the flags to display BEFORE the country's name, I'd appreciate it.

Forgot - If you look at the block - would you mind ADDING a line for a BACKGROUND color? My default block background is white, and that causes many .GIFs to "wash out".

Thanks again -




_________________
I can explain it to you, but I can’t UNDERSTAND it for you.
[ Register or login to view links on this board. ]
Back to top Reply with quote
#2   re: MS-Analysis1.php - need a little help with this block pl
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Theres a few things I see

1. $module_name -- needs to be added to the globals.
2. while(list($lid, $title, $hits, $flag) -- You have to define $domain in this as well so something like-- while(list($lid, $domain, $title, $hits, $flag)
3. Move the $flag= "modules/$module_name/images/flags/$domain".".gif"; to under the while(list
4. $show = ""; cant use that twice.
5. select domain, description, hits your selecting this but listing this-- list($lid, $domain, $title, $hits, $flag

Can you attach a copy of the structure for
_msanalysis_countries.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: MS-Analysis1.php - need a little help with this block pl
Mindvacant
CZ Newbie
Mindvacant has been a member for over 20 year's 20 Year Member
Website:
Status: Offline
Joined: Dec 25, 2003
0.00 posts per day
Posts: 22
Points: 1,942
   
I think I followed your instructions.

The complete path to the FLAGS:
mindvacant.com/php/html/modules/MS_Analysis/images/flags/*.gif

I'm know I'm doing something wrong with the $FLAG variable, because I can get the others to scroll by removing one then another.

Thanks for your time,

FIle after applying Telli's tips:

<?php
$maxshow = 200; // # of Countries

if (eregi("block-ScrollCountriesTest.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

global $prefix, $db, $domain, $flag;
$show = "";
$a = 1;
$result = $db->sql_query( "select domain, description, hits from $prefix"._msanalysis_countries." order by hits DESC LIMIT 0,$maxshow");
//while(list($lid,$domain,$title,$hits,$flag) = $db->sql_fetchrow($result)) {
while(list($lid,$title,$domain,$flag) = $db->sql_fetchrow($result)) {
$flag = "modules/$module_name/images/flags/$domain".".gif";
// $flag = "modules/MS_Analysis/images/flags/$domain".".gif";
$title2 = ereg_replace("_", " ",$title);
$show .= "$title2</a><br>";
$a++;
}
$content = "<A name= \"scrollingCountries\"></A>\n";
$content .= "<MARQUEE behavior= \"scroll\" align=\"right\" direction= \"up\" height=\"320\" scrollamount= \"3\" scrolldelay= \"90\" onmouseover='this.stop()' onmouseout='this.start()'>\n";
$content .= "$show";
$content .= "</marquee>\n";


?>




_________________
I can explain it to you, but I can’t UNDERSTAND it for you.
[ Register or login to view links on this board. ]
Back to top Reply with quote
#4   re: MS-Analysis1.php - need a little help with this block pl
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
$result = $db->sql_query( "select domain, description, hits from $prefix"._msanalysis_countries." order by hits DESC LIMIT 0,$maxshow"

Should be

$result = $db->sql_query( "select lid, domain, title, hits from $prefix"._msanalysis_countries." order by hits DESC LIMIT 0,$maxshow"


You should use something like this for the flags.

// Determine Location for Flag image
      $FlagResult = sql_query( "select flag from $prefix"._msanalysis_countries." order by hits DESC LIMIT 0,$maxshow";
      $FlagInfo =   sql_fetch_array( $FlagResult, $dbi );
      $FlagPathFile = $FlagPath.$FlagInfo;


WHen i asked for table structure I mean the field names in the databse table $prefix"._msanalysis_countries."



_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum