We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27449
    • 211 Posts
    Hello,
    In my website I need to add the weather of three cities and I search the snipped WeatherX and install it in the modx.
    I call the snipped for show the weather of the first city and work very well
    At the moment no problem...
    But when I call the snipped for show the weather for the second city I have an error.

    Please can you assist me how I show the weather for three diferent cities

    Thank you
      • 10449
      • 956 Posts
      Quote from: sjscosta at Mar 13, 2009, 08:26 AM

      I have an error.

      That’s not very descriptive - what is the error message saying? Are you getting the same city-data 3 times?
        • 27449
        • 211 Posts
        The error that I have is :
        Fatal error: Cannot redeclare setplaceholders()

        and I want show the weather of three distinct cities.


        I don’t know if I do correct, but I call the snipped WeatherX three times with the zipcode of the cities.
          • 10449
          • 956 Posts
          That basically means the snippet re-declares [+placeholders+] each time the snippet is run. If you’re using the same snippet more than once per document, this won’t work. That’s what the error msg is saying. Can you try to use 1 document per city, and aggregate its output via Ditto? Another solution is to rewrite the snippet so it only does

          return($output)

          at the end.

          i.e. replace lines 73 + 104: setPlaceholders($arr1, $arr2);