Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
izone
Involved
Involved



Joined: Sep 07, 2004
Posts: 354
Location: Sweden

PostPosted: Thu Sep 09, 2004 4:17 am Reply with quote

Hi!

I just wonder if it is possible to change the looking of just one block without changing others.

I have subBlack3dBlue theme and on my site I've Weather module too. Background of it's block is white and so is the text. Because of that you cann't see the text in this block.

How can I do it?

Best regards
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Sep 09, 2004 4:33 am Reply with quote

This will be a bit dependent on your block, of course. Let's assume you wanted to change the background color of the block. Find the first reference to $content. It should be $content = ""; Modify that line to read $content = "<div style=\"background-color:#FFFF00;\">"; Of course you will change the FFFF00 to whatever color you want.

Then, and it should be the last line of code in the block, find $content .= "</form>"; and change it to $content .= "</form>&nbsp;</div>";[/code]
Of course you may not have form tags, but the logic is the same. Just wrap the $content in a <div></div>. If that does not change the attributes that you want to change, try using <span></span> tags around what you are trying to change. Bottom line is that you need to use in-line style tags to override the CSS styles.
 
View user's profile Send private message
izone







PostPosted: Thu Sep 09, 2004 5:31 am Reply with quote

Thanks for helping. But I cann't find these so I show you the source:

Code:


<?php

/************************************************************************************/
/*                                                                                  */
/* WEATHER BLOCK: block-MS-Weather.php                                              */
/* v3.0c  11-07-2003 FOR PHP-NUKE 6.5                                               */
/*                                                                                  */
/* Copyright © 2002 by: Maty Scripts (webmaster@matyscripts.com)                    */
/* http://www.matyscripts.com                                                       */
/*                                                                                  */
/* This program is free software. You can redistribute it and/or modify             */
/* it under the terms of the GNU General Public License as published by             */
/* the Free Software Foundation; either version 2 of the License.                   */
/*                                                                                  */
/************************************************************************************/
# Cache File Date routine is from:             
# NukeScripts Network (webmaster@nukescripts.com)
# Copyright © 2002, All rights reserved
# http://www.nukescripts.net
/************************************************************************************/

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

// Some used Global Variables
global $db, $prefix, $currentlang, $language;

$module_name  = "MS_Weather";
require_once( "modules/$module_name/class.msweather.php" );
$msw = new msweather();

// Set Language file
if (file_exists("modules/$module_name/language/lang-$currentlang.php")) { include_once("modules/$module_name/language/lang-$currentlang.php"); }
else { include_once("modules/$module_name/language/lang-$language.php"); }

// Read Preferred city codes
$result = $db->sql_query( "select mswv1, mswv2 from $prefix"._msweather." where type='3'" );
list( $cityname, $citycode ) = $db->sql_fetchrow( $result );
   
// Read Preferred Unit ( [0] = Celsius - [1] = Fahrenheid and cache parameters
$result = $db->sql_query( "select mswv1, mswv2, mswv3 from $prefix"._msweather." where type='1'" );
list( $unit, $cachetype, $cacheinterval ) = $db->sql_fetchrow( $result );

// Determine if Weather data should be cached again ==>
// Code from: NukeScripts Network (webmaster@nukescripts.com): http://www.nukescripts.net
$cache_file = "modules/$module_name/cache/".$citycode.".dat";
if( file_exists( "$cache_file" ) ) {
   $cachefiletime = filemtime( $cache_file );
   if( $cachetype == 0 ) {
      $comparetime = date("Y-m-d H:i", mktime (0,0,0,date("m",$cachefiletime),date("d",$cachefiletime)+$cacheinterval,date("Y",$cachefiletime)));
   } elseif ( $cachetype == 1 ) {
      $comparetime = date("Y-m-d H:i", mktime (date("G",$cachefiletime)+$cacheinterval,date("i",$cachefiletime),0,date("m",$cachefiletime),date("d",$cachefiletime),date("Y",$cachefiletime)));
   } elseif ( $cachetype == 2 ) {
      $comparetime = date("Y-m-d H:i", mktime (date("G",$cachefiletime),date("i",$cachefiletime)+$cacheinterval,0,date("m",$cachefiletime),date("d",$cachefiletime),date("Y",$cachefiletime)));
   }
}
// END Code from: NukeScripts Network (webmaster@nukescripts.com): http://www.nukescripts.net

// If required, cache Weather data again and display block info - eache Cityname can be seperately cached
$currenttime = date("Y-m-d H:i");
if( ( ! ( file_exists( $cache_file ) ) )  || ( $comparetime < $currenttime ) || ( ! ( filesize( $cache_file ) ) ) ) {
   // Store and Read all Required data for $cityname/$citycode
   $content = $msw->msw_saveblockdata( $cityname, $citycode, $unit, $cache_file, $module_name );
}
else {
   // Read all Required data for $cityname/$citycode from cache file
   $content = $msw->msw_readblockdata( $cache_file );
}

?>


Would you please help me with this?
Regards
 
GanjaUK
Life Cycles Becoming CPU Cycles



Joined: Feb 14, 2004
Posts: 633
Location: England

PostPosted: Thu Sep 09, 2004 7:47 am Reply with quote

Are you saying that you have 1 block that is a different colour? What's the url to your site so I can check what you mean.

_________________
Image
Need a quality custom theme designed? PM me!
 
View user's profile Send private message Visit poster's website
Tao_Man
Involved
Involved



Joined: Jul 15, 2004
Posts: 252
Location: OKC, OK

PostPosted: Thu Sep 09, 2004 12:51 pm Reply with quote

I think he is saying that he wants just one block to have a diffrent color

_________________
------------------------------------------
To strive, to seek, to find, but not to yield!
I don't know Kara-te but I do know cra-zy, and I WILL use it! 
View user's profile Send private message Visit poster's website
GanjaUK







PostPosted: Thu Sep 09, 2004 12:56 pm Reply with quote

Well as he said 1 has white background with white text, so it sounds like just 1 block. Shocked
 
izone







PostPosted: Thu Sep 09, 2004 1:54 pm Reply with quote

GanjaUK wrote:
Are you saying that you have 1 block that is a different colour? What's the url to your site so I can check what you mean.


Thank you for answering.

I came back later today but the site wasn't up.

What I mean is my block for Weather is not showing all the text because of the white colour of bg and the text.

The url of my site is: http://www.iranyad.com

Look yourself please and try to see if you see the weather prognos text. The code I show above is source of the block-MS-Weather.php file.

Is there any way to change it?
regards
 
Tao_Man







PostPosted: Thu Sep 09, 2004 2:44 pm Reply with quote

there is a file modules/MS_Weather/msw_config.php

there is a place in there to set font color.

The only white on white I saw was under the moon, I guess for night time tempature. I have never used the block but downloaded to see.

Check out the msw_config.php file, bet it will do the trick.
 
GanjaUK







PostPosted: Thu Sep 09, 2004 3:01 pm Reply with quote

Looks like the white text on white background is just on the cell behind the moon area, and the colour of the background is: EEEEEE, I would check class.msweather.php 1st and look for: eeeeee Change that to whatever colour you need.
 
izone







PostPosted: Fri Sep 10, 2004 3:01 am Reply with quote

Thank you all!

I did changed the value of colour in the msw_config.php and it didn't change anything!

I changed som value in the class.msweather.php

Code:


  // Display Forecast
            eregi( "<!----------------------- FORECAST ------------------------->(.*)<!--ENDFC-->", $rf, $all );
            $all[ 1 ] = str_replace( "<!-- SpaceID=0 robot -->", "<A target=\"_blank\" href=\"http://www.weather.com/weather/extended/".$citycode."?par=yahoo&amp;site=www.yahoo.com&amp;promo=forecast\">"._MSW_EXTENDED."</A>", $all[ 1 ] );
            $all[ 1 ] = str_replace( "=#333333", "=".$TableBar, $all[ 1 ] );
            $all[ 1 ] = str_replace( "=#333333", "=".$TableBackGround, $all[ 1 ] );
            $all[ 1 ] = str_replace( "face=Arial", "face=Arial size=2 color=".$TableFontColor, $all[ 1 ] );
            $MSWModule .= "<center>".$all[ 1 ]."</center><br><br>";
         }

         if( $showmore ) {


and it changed only the bg colour of a broadcasting table in the main page not in the block.

How can I change the white bgcolour on the cell behind the moon area?

Here is the source of class.msweather.php file:

Code:


<?php

/************************************************************************************/
/*                                                                                  */
/* MS-Weather: class.msweather.php                                                  */
/* v3.0c  11-07-2003 FOR PHP-NUKE 6.5                                               */
/*                                                                                  */
/* Copyright © 2002 by: Maty Scripts (webmaster@matyscripts.com)                    */
/* http://www.matyscripts.com                                                       */
/*                                                                                  */
/* This program is free software. You can redistribute it and/or modify             */
/* it under the terms of the GNU General Public License as published by             */
/* the Free Software Foundation; either version 2 of the License.                   */
/*                                                                                  */
/************************************************************************************/
global $TableBar, $TableBackGround, $TableFontColor, $TempFontColor;
// Colors that can be changed for the Weather Overview in the Module
include(dirname(__FILE__) . '/msw_config.php' );

class msweather
{
   /******************************************************/
   /*                                                    */
   /* Constructor function msweather()                   */
   /*                                                    */
   /******************************************************/
   function msweather()
   {

   }

   /******************************************************/
   /*                                                    */
   /* Constructor function msw_openpage()                */
   /*                                                    */
   /******************************************************/
   function msw_openpage( $citycode, $unit )
   {
      // Page to open
      if( $unit == 0 ) { $openfile = "http://weather.yahoo.com/forecast/".$citycode."_c.html"; }
      else { $openfile = "http://weather.yahoo.com/forecast/".$citycode."_f.html"; }

      $openerror = 0;
      $mswdata = @implode ( '', file( $openfile ) );
      if( $mswdata == FALSE )  {
         $mswdata = ""._MSW_OPENERROR."";
         $openerror = 1;
      }
      return( $mswdata );
   }
   
   /******************************************************/
   /*                                                    */
   /* function get_msw_blockdata()                       */
   /*                                                    */
   /******************************************************/
   function msw_saveblockdata( $cityname, $citycode, $unit, $cache_file, $module_name )
   {
      global $TempFontColor;
      // Open en load Yahoo Weather page
      $rf = $this->msw_openpage( $citycode, $unit );
      if( $rf <> ""._MSW_OPENERROR."" ) {
     
         // Filter ALL Required data for selected City
         eregi( "<!--CURCON-->(.*)<!--END CURCON-->", $rf, $all );
         
         // Display Information for Weather block
         $MSWblock  = "<center><b>".$cityname." "._MSW_TODAY."</b></center>";
         $MSWblock .= "<center>".$all[ 1 ]."</center>";
         $MSWblock .= "<center><b><a href=\"modules.php?op=modload&amp;name=".$module_name."&amp;file=index&amp;op=MSWeatherShowForcast\">"._MSW_FORECAST."</a></b></center>";

         // Set font size and colors of temperature block
         $MSWblock = $this->msw_settempcolors( $MSWblock, $TempFontColor );
         // Decode Language
         $MSWblock = $this->msw_languagedecode( $MSWblock, 0 );
         // Setup Select City Mechanism
         $MSWblock .= $this->msw_displaycities( $cityname, $module_name );

         // Write filtered information to cache File
         $MSWwrite = @fopen( $cache_file, 'w' );
         if( !$MSWwrite ) {
            $errormessage = ""._MSW_WRITEERROR."";
         } else {
            fputs( $MSWwrite, "$MSWblock" );
            fclose( $MSWwrite );
         }
      } else {
         $errormessage = ""._MSW_OPENERROR."";
      }
     
      // Return data for block
      if( isset( $errormessage ) ) { return( $errormessage ); }
      else {
         return( $MSWblock );
      }
   }

   /******************************************************/
   /*                                                    */
   /* function get_msw_readblockdata                     */
   /*                                                    */
   /******************************************************/
   function msw_readblockdata( $cache_file )
   {
      if( file_exists( $cache_file) ) {
         $MSWread  = fopen( $cache_file, 'r' );
         $MSWblock = fread( $MSWread, filesize( $cache_file ) );
         fclose( $MSWread );
         return( $MSWblock );
      } else {
         return( "Error!" );
      }
   }

   /******************************************************/
   /*                                                    */
   /* function get_msw_getmoduledata()                   */
   /*                                                    */
   /******************************************************/
   function msw_getmoduledata( $cityname, $citycode, $unit, $module_name, $showgeneral, $showforecast, $showmore )
   {
      global $TableBar, $TableBackGround, $TableFontColor, $TempFontColor;
      // Open en load Yahoo Weather page
      $rf = $this->msw_openpage( $citycode, $unit );
      if( $rf <> ""._MSW_OPENERROR."" ) {
         $rf = $this->msw_settempcolors( $rf, $TempFontColor );
         $rf = $this->msw_languagedecode( $rf, 1 );
         $MSWModule = "";
         if( $showgeneral ) {
            $MSWModule .= "<div align=\"center\"><center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\"><tr><td width=\"100%\">\n";
            // Display General Overview
            eregi( "<!--CURCON-->(.*)<!--endscale-->", $rf, $all );
            if( $unit == 0 ) {
               $MSWModule .= "<center><a href=modules.php?name=$module_name&amp;file=index&op=MSWeatherShowForcast&amp;cityname=$cityname&amp;citycode=$citycode&amp;unit=1><b>Fº</b></a> | <b>Cº</b></center>";
            } else {
               $MSWModule .= "<center><b>Fº</b> | <a href=modules.php?name=$module_name&amp;file=index&op=MSWeatherShowForcast&amp;cityname=$cityname&amp;citycode=$citycode&amp;unit=0><b>Cº</b></a></center>";
            }
            $MSWModule .= "<center>".$all[ 1 ]."</center><br><br>";
            $MSWModule .= "</td></tr></table></center></div>\n";           
         }
         
         if( $showforecast ) {
            // Display Forecast
            eregi( "<!----------------------- FORECAST ------------------------->(.*)<!--ENDFC-->", $rf, $all );
            $all[ 1 ] = str_replace( "<!-- SpaceID=0 robot -->", "<A target=\"_blank\" href=\"http://www.weather.com/weather/extended/".$citycode."?par=yahoo&amp;site=www.yahoo.com&amp;promo=forecast\">"._MSW_EXTENDED."</A>", $all[ 1 ] );
            $all[ 1 ] = str_replace( "=#333333", "=".$TableBar, $all[ 1 ] );
            $all[ 1 ] = str_replace( "=#333333", "=".$TableBackGround, $all[ 1 ] );
            $all[ 1 ] = str_replace( "face=Arial", "face=Arial size=2 color=".$TableFontColor, $all[ 1 ] );
            $MSWModule .= "<center>".$all[ 1 ]."</center><br><br>";
         }

         if( $showmore ) {
            // Display Current Conditions
            eregi( "<!--MORE CC-->(.*)<!--ENDMORE CC-->", $rf, $all );
            $all[ 1 ] = str_replace( _MSW_SHOWMORE, "<td bgColor=".$TableBar." width=\"100%\"><font face=\"Arial\" color=".$TableFontColor." size=\"2\"><center><b>"._MSW_SHOWMORE."</b></center></font></td>", $all[ 1 ] );
            $all[ 1 ] = str_replace( "face=Arial", "face=Arial size=2 color=".$TableFontColor, $all[ 1 ] );
            $all[ 1 ] = str_replace( "<td>", "<td bgcolor=".$TableBackGround.">", $all[ 1 ] );
            $MSWModule .= "<center>".$all[ 1 ]."</center>";
         }
         return( $MSWModule );
      } else {
         return( ""._MSW_OPENERROR."" );
      }
   }

   /******************************************************/
   /*                                                    */
   /* function msw_displaycities()                       */
   /*                                                    */
   /******************************************************/
   function msw_displaycities( $cityname, $module_name )
   {
      global $db, $prefix;
     
      $selcity  = "<form enctype=\"multipart/form-data\" method=\"post\" action=\"modules.php?op=modload&name=$module_name&file=index&amp;op=MSWeatherDecode&amp;pcity=$pcity\">";
      $selcity .= "<center>"._MSW_SELECTCITY."<select name=\"pcity\" onChange=\"submit()\">";
      $result = $db->sql_query( "select mswv1, mswv2 from $prefix"._msweather." where type='4' ORDER BY mswv1 ASC" );
      while( list( $dbcityname, $dbcitycode ) = $db->sql_fetchrow( $result ) ) {
         if( $dbcityname == $cityname ) { $selcity .= "<option selected>".$dbcityname."</option>"; }
         else { $selcity .= "<option>".$dbcityname."</option>"; }
      }
      $selcity .="</select></center></form>";
      return( $selcity );
   }

   /******************************************************/
   /*                                                    */
   /* function msw_settempcolors( )                      */
   /* Set font size + color temperature block            */
   /******************************************************/
   function msw_settempcolors( $rf, $TempFontColor )
   {
      $rf = str_replace( "<font face=Arial size=2>Currently:", "<font color=".$TempFontColor." face=Arial size=2>Currently:", $rf ); // Temp now
      $rf = str_replace( "<font size=\"5\"", "<font size=\"5\" color=".$TempFontColor, $rf ); // Temp Now
      $rf = str_replace( "<!-- teswt -->", "<!-- teswt --><font face=Arial size=2 color=".$TempFontColor.">", $rf ); // Weather Tekst
      $rf = str_replace( "Hi:", "</font><font face=Arial color=".$TempFontColor." size=2>Hi:", $rf ); // Temp Hi
      $rf = str_replace( "Lo:", "</font><font face=Arial color=".$TempFontColor." size=2>Lo:", $rf ); // Temp Lo
      return( $rf );
   }

   /******************************************************/
   /*                                                    */
   /* function msw_languagedecode()                      */
   /*                                                    */
   /******************************************************/
   function msw_languagedecode( $rf, $BorM )
   {
      $rf = str_replace( "More Current Conditions", _MSW_MORECURRENT, $rf );
      $rf = str_replace( "Feels Like", _MSW_FEELSLIKE, $rf );
      $rf = str_replace( "Barometer", _MSW_BAROMETER, $rf );
      $rf = str_replace( "Humidity", _MSW_HUMIDITY, $rf );
      $rf = str_replace( "Visibility", _MSW_VISIBILITY, $rf );
      $rf = str_replace( "Dewpoint", _MSW_DEWPOINT, $rf );
      $rf = str_replace( "Sunrise", _MSW_SUNRISE, $rf );
      $rf = str_replace( "Sunset", _MSW_SUNSET, $rf );
      $rf = str_replace( "Unavailable", _MSW_UNAVAILABLE, $rf );
      $rf = str_replace( "Unlimited", _MSW_UNLIMITED, $rf );
      $rf = str_replace( "in the", _MSW_INTHE, $rf );

      $rf = str_replace( "Scattered", _MSW_SCATTERED, $rf );
      $rf = str_replace( "Isolated", _MSW_ISOLATED, $rf );
      $rf = str_replace( "Thunderstorms", _MSW_THUNDERSTORMS, $rf );     
      $rf = str_replace( "with", _MSW_WITH, $rf );     
      $rf = str_replace( "Thunder", _MSW_THUNDER, $rf );
      $rf = str_replace( "Showers", _MSW_SHOWERS, $rf );
      $rf = str_replace( "Shower", _MSW_SHOWER, $rf );
      $rf = str_replace( "Partly", _MSW_PARTLY, $rf );
      $rf = str_replace( "Mostly", _MSW_MOSTLY, $rf );
      $rf = str_replace( "Light", _MSW_LIGHT, $rf );
      $rf = str_replace( "Heavy", _MSW_HEAVY, $rf );     
      $rf = str_replace( "Cloudy", _MSW_CLOUDY, $rf );
      $rf = str_replace( "Snow", _MSW_SNOW, $rf );
      $rf = str_replace( "Haze", _MSW_HAZE, $rf );
      $rf = str_replace( "Drizzle", _MSW_DRIZZLE, $rf );
      $rf = str_replace( "Sunny", _MSW_SUNNY, $rf );
      $rf = str_replace( "Fair", _MSW_FAIR, $rf );
      $rf = str_replace( "Rain", _MSW_RAIN, $rf );
      $rf = str_replace( "Wind", _MSW_WIND, $rf );
      $rf = str_replace( "AM", _MSW_AM, $rf );
      $rf = str_replace( "PM", _MSW_PM, $rf );
      $rf = str_replace( "Few", _MSW_FEW, $rf );
      $rf = str_replace( "Vicinity", _MSW_VICINITY, $rf );
      $rf = str_replace( "Clouds", _MSW_CLOUDS, $rf );
      $rf = str_replace( "Early", _MSW_EARLY, $rf );
      $rf = str_replace( "Clearing", _MSW_CLEARING, $rf );
      $rf = str_replace( "Late", _MSW_LATE, $rf );
      $rf = str_replace( "Fog", _MSW_FOG, $rf );
      $rf = str_replace( "Clear", _MSW_CLEAR, $rf );
      $rf = str_replace( "Drifting", _MSW_DRIFTING, $rf );

      if( $BorM == 0 ) {
         // Use for the block shorter translations, otherwise the block becomes to wide
         $rf = str_replace( "Currently:", _MSW_NOW, $rf );
         $rf = str_replace( "Hi:&nbsp;",  _MSW_HI."<br>", $rf );
         $rf = str_replace( "Lo:&nbsp;",  _MSW_LO."<br>", $rf );
      } else {
         // For the Modul display there are no restrictions with respect to the length of the names
         $rf = str_replace( "Currently:", _MSW_CURRENTLY, $rf );
         $rf = str_replace( "Hi:&nbsp;", _MSW_HIGH."<br>", $rf );
         $rf = str_replace( "Lo:&nbsp;", _MSW_LOW."<br>", $rf );
      }
      $rf = str_replace( "High:", _MSW_HIGH, $rf );
      $rf = str_replace( "Low:", _MSW_LOW, $rf );
      $rf = str_replace( "Today", _MSW_TODAY, $rf );
      $rf = str_replace( "Tomorrow", _MSW_TOMORROW, $rf );
      $rf = str_replace( "Sun", _MSW_SUN, $rf );
      $rf = str_replace( "Mon", _MSW_MON, $rf );
      $rf = str_replace( "Tue", _MSW_TUE, $rf );
      $rf = str_replace( "Wed", _MSW_WED, $rf );
      $rf = str_replace( "Thu", _MSW_THU, $rf );
      $rf = str_replace( "Fri", _MSW_FRI, $rf );
      $rf = str_replace( "Sat", _MSW_SAT, $rf );
      $rf = str_replace( "Day", _MSW_DAY, $rf );
      return( $rf );
   }

}

?>


regards
 
GanjaUK







PostPosted: Fri Sep 10, 2004 11:27 am Reply with quote

Email me the archive for the script, I can't download it from matyscripts getting 500 error.

email: webmaster[at]ganjauk[dot]com
 
izone







PostPosted: Sat Sep 11, 2004 2:42 am Reply with quote

GanjaUK wrote:
Email me the archive for the script, I can't download it from matyscripts getting 500 error.

email: webmaster[at]ganjauk[dot]com


You've got mail!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©