Web Weather > Custom Website Templates
updating my include-astronomy.php page
(1/1)
Gregal:
I seem to be having an issue with my include-wxastronomy.php file I get the following error, Fatal error: Cannot redeclare langtrans() (previously declared in www.allshouse.net/Test1/include-wxastronomy.php:415) in www.allshouse.net/Test1/common.php on line 72. Any ideas what can be causing this?
I updated the common.php file this morning because the old file did not include the updated dates through 2030, I also updated the test tags.txt file to add in the needed lines of code for suntransit and moontransit etc.
Thank you for your help
Jasiu / JJ:
Took a look at the code via https://www.allshouse.net/Test1/include-wxastronomy.php?sce=view
--- Code: ---if(!function_exists('langtrans') ) {
function langtrans($input) {
print $input;
}
}
if (isset($_GET["frame"])) $generate_FrameCode = $_GET["frame"];
if ((include_once "testtags.php") == 0)
exit("This script requires WD testtags.php for the moon info");
if ((include_once "common.php") == 0) {
function langtransstr($word) {
global $translations;
if (isset($translations[$word])) {
if ($word==$translations[$word]) // highlight non translated text
return '<span style="background-color: red; color: yellow;">'.$word.'</span>';
else return $translations[$word];
} // highlight text not in translation table
else return '<span style="background-color: red; color: yellow;">'.$word.'</span>';
}
}
--- End code ---
The check for langtrans that is at the top of this section should go inside "if ((include_once "common.php") == 0) {". That's because common.php is where the function is located. Not sure why this even needs to be checked, though. Maybe for a stand-alone mode?
Navigation
[0] Message Index
Go to full version