Author Topic: updating my include-astronomy.php page  (Read 903 times)

0 Members and 1 Guest are viewing this topic.

Offline Gregal

  • Member
  • *
  • Posts: 17
    • Hilltop Inspiration
updating my include-astronomy.php page
« on: December 04, 2024, 10:26:34 AM »
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

Offline Jasiu / JJ

  • Forecaster
  • *****
  • Posts: 1030
    • LexMAWeather
Re: updating my include-astronomy.php page
« Reply #1 on: December 04, 2024, 01:34:52 PM »
Took a look at the code via https://www.allshouse.net/Test1/include-wxastronomy.php?sce=view

Code: [Select]
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>';

   }

}


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?
https://lexmaweather.info
Mastodon: @LexMAWeather@toot.community
Bluesky: @LexMAWeather.toot.community.ap.brid.gy