A CLOSER LOOK
Let’s take a look at Plan A. In your weather page template, you will have a tag that looks like this:
<!--outsideTemp--> A standard WL tag.
That would be replaced with this:
<span class="ajax" id="ajaxoutsideTemp"><!--outsideTemp--></span>
The first part of this, <span class="ajax" id="ajaxoutsideTemp"> invokes the AJAX portion. It is closed by </span>. A corresponding WL tag is in the middle. When javascript is enabled, the WL tag data is disregarded and inserts the fresh AJAX data in its place. If a visitor happens to have javascript disabled, the AJAX data will not display but will now use the WL tag data to report the weather data from the last time the complete weather page was uploaded. Just like it has always worked before. If you normally upload your web page every ten minutes or so, you can still do this and have the weather data updated every minute. Your non-javascript visitors will see your data like they always have before while all other will see the latest data every minute.
Plan B is similar to Plan A. Instead of using a WL tag in the middle, php will be used for non-javascript users. This plan requires a second data template file that creates the php variables and names. It needs to be uploaded every minute like the first data template.
<span class="ajax" id="ajaxoutsideTemp"><?php echo $outsideTemp; ?></span>
Plan B eliminates parsing the complete weather page for non-javascript viewers and gives everybody the latest weather data. Since it uses PHP, your web host must have PHP.
If you are not concerned about the small amount of non-javascript viewers, Plan A would be the choice and you can remove the WL tags in the middle of the spans to cut down your web page size.
Here is another option. If you don't want AJAX but would like to have fresh data every minute, just use the php. The weather data displayed will update when the browser opens the page or gets re-freshed. This would suit both types of javascript viewers.
|