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
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.
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);