Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Adding Weather - Customizing Category Table

Quote Reply
Adding Weather - Customizing Category Table
I'm working on customizing LinksSQL to add some weather info (hamweather) that will basically require me to add fields for using the info (Y/N), city, state, zip, country, link, etc... I have two ways to possibly go about this and wondering if anyone has made any similar customizations. I may later add other regional info. I'm trying to get an idea of which option will result in better overall performance...

First option:
Add all the appropriate fields to the Category table.

Second option:
Add only a WeatherYN and WeatherID field to the Category table and then create a new Cities table that will contain all the information I need on the cities I want to include.

Anyone have any thoughts? Anyone done anything like this that they could share?

Jerry
Quote Reply
Re: Adding Weather - Customizing Category Table In reply to
I'm not sure what you are trying to do with it.

There are several modules/parts of HamWeather that allow it to integrate into a variety of situations.

I'm using it as a pure add on, and I'm sending images to the postcards program, for people to send weather cards.

There is the HWScroll applet that can be included in a page, and you can also use plain <img src> tags. With HWImage it will generate the image files on the fly as pages load.

Quote Reply
Re: Adding Weather - Customizing Category Table In reply to
What I'm hoping to be able to do create dynamic links in part of a nav bar... So for example, I can select to use a weather link or not in certain catgories, and then if I decide to use a link, I can put the default city name into the link or search box, based upon the category that I'm in...

For example, if you go to the hamweather area, there is a default city used in the configuration.. I want to change that based upon the category, so if I'm in a Philadelphia category, it will say Philadelphia, or New York in a New York category. Makes it nice so people don't have to type it in.

I think where I need to be working towards is a custom <% if %> set of tags like
<%if WeatherCity%>
put custom code here...
<%endif%>
but I haven't figured out how to do that yet...

Jerry
Quote Reply
Re: Adding Weather - Customizing Category Table In reply to
Code:
<DIV ALIGN=RIGHT>
<form method="POST" action="%%scripturl%%">
<TABLE WIDTH=100%><TR>
<TD ALIGN=RIGHT><font FACE=ARIAL SIZE=2><FONT SIZE=3 color="#000080"><B>POSTCARDS<BR>Weather:</B></FONT></TD>
<TD ALIGN=RIGHT> Enter Your <B>"City, State",<BR>State, or ZIP</B>: </font></TD>
<TD><input type="hidden" name="theme" value="%%theme%%">
<input type="hidden" name="user" value="%%user%%">
<input type="hidden" name="forecast" value="zandh">
<input type="text" name="pands" size="15" value="%%lplace%%, %%lstate%%">
<input type="submit" value="GO" name="Submit"> </TD>
</tr></table>
</form>
</DIV>

This is the HAMWEATHER code I use to insert the stuff in the program. You can put this into Links, by changing the %% tags to <% and %> tags, and hard coding the script url and other information such as theme. Only leave the "%%lplace%%, %%lstate%%" as Links variables "<%city%>, <%state%>" or even <%zip%> ... whatever you have coded into your database.

Wrap the whole code segment in an <%if value%> set of tags, based on whether you are searching by city/state/zip

So,

<%if city%>
<%if state%>
....code....
<%endif%>
<%endif%>

That way, you'll only insert the select box if the city & state exist.

You can do the same with an automatically inserted map, or even HWSCROLL by feeding in the <%city%> <%state%> parameters to the appropriate value tag.

_REMEMBER_ the %% and <% %> tags ONLY MATTER IN THE TEMPLATE WHEN IT's BEING PROCESSED! Once the form is sent to the browser, all those tags are replaced, so you just need to adapt them to whichever template you are using.

FWIW... I asked Tony why he used %% rather than <% and %> tags, or something else, and he said it was so he could include the %%TAG%% in the command line/ URL. This way you can pass blank values and place holders between scripts, where the > and < will cause problems and need to be escaped.