Elxis CMS Forum
Extensions => Components => Topic started by: eliasbou on April 19, 2011, 16:40:22
-
Hi. After installation component weather in clean installation elxis in the appearance component I take and something waste, you know what can be. I thank.
[attachment deleted by admin]
-
Write the address of the site
-
http://www.ofmessinia.gr/
-
I'm confused.
Maybe I forgot to remove debugging information.
Get me you e-mail, i send new component
-
Hello. I got email and installed new component but did not exist no change. I tryed him http://www.webico.gr/demo/elxis/ and for i got the same result.
I thank.
-
Replace this file in /administrator/components/com_weather/includes and test.
[attachment deleted by admin]
-
Τhe same fault :-[
-
The problem is caused here:
file: includes/weather.class.php
line: 148
$this->cache_file = $this->cache_path . '/' . $this->filename_safe(eUTF::utf8_to_ascii($this->location)."_".$this->lang);
I advice you not to use the utf-8 encoded location name as the filename for cache. After the conversions you do you change the cache filename and when you want to used the cached file the reverse conversion might not be the same...
Use the location's id instead to generate the cache file.
So add a new attribute in weatherPlugin class constructor named "locid" (note that I made all attributes required).
public function __construct($location, (bool)$browse_lang, (int)$locid) {
Then do this:
$this->cache_file = $this->cache_path.'/'.$locid.'_'.$this->lang;
I also advise you to use a prefix and get the md5 value for the string for the cache filename.
Example:
$this->cache_file = $this->cache_path.'/'.md5('weather_'.$locid.'_'.$this->lang);
and open weather.php and change this:
$plugin = new $plugin_class($row->location, $cweather->cfg->get('GFBROWSE_LANG', 1));
To this:
$plugin = new $plugin_class($row->location, $cweather->cfg->get('GFBROWSE_LANG', 1), $row->id);
Check if you need to update more files in order to feed the weatherPlugin constructor with the proper location id.
Related tip:
A cool way to get rid of special characters and tags for a string is to use the php's 5.2+ filter_var function:
$clean = filter_var($unclean_var, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH);
If your string contains non ascii characters then use only the "LOW" flag.
-
New version 1.2 updated on EDC.
-
With the new version all work OK, thank. ;)