Version: 1.00, by benstillman
Developer Last Online: May 2014
Category: vBulletin CMS Widgets -
Version: 4.0.x
Rating:
Released: 06-13-2010
Last Update: Never
Installs: 36
Re-useable Code Translations
No support by the author.
This adds the Weather Channel widget to your CMS, pulling the weather from the user's zip code.
- Create a new style template titled "vbcms_widget_weather".
- Create a new profile field named "zip code". Take note of the profile field number.
- Insert the following into the new template, changing $bbuserinfo[fieldXX] to the correct field number ($bbuserinfo[field8] in my case):
Code:
<div class="cms_widget">
<div class="block">
<div class="cms_widget_header">
<h3>{vb:raw widget_title}</h3>
</div>
<div class="cms_widget_content">
<center>
<vb:if condition="is_member_of($bbuserinfo, 1)">
Registered members can see their local weather forcast here.
<br /><br />
<a href="{vb:raw vboptions.bburl}/register.php">Click here to register!</a>
<br /><br />
<vb:else />
<vb:if condition="$bbuserinfo[fieldXX] !=''">
<script src='http://voap.weather.com/weather/oap/{vb:raw bbuserinfo.fieldXX}?template=GENXV&par=3000000007&unit=0&key=twciweatherwidget'></script>
<vb:else />
Add your <A HREF="{vb:raw vboptions.bburl}">/profile.php?do=editprofile">Zip Code</A> to show weather forcast.
</vb:if>
</vb:if>
</center>
</div>
</div>
</div>
- Create a new widget with type "Static HTML".
- Title it "Weather" or whatever else you want.
- Save it.
- Configure the widget to use the "vbcms_widget_weather" template.
- Add the widget to your CMS where ever you like.
EDIT: Some users are having a difficult time following my instructions. It makes sense to me, but I guess I'm the only one. Here's Octavius' version of the instructions:
Quote:
Originally Posted by Octavius.
In that code he posted you will see fieldXX and if you look a little further you'll see field8
Replace both fieldXX and field8 with the profile field number that you created for the zip code.
That's the fist part.
Second part, do what aenable did in his post.
3rd part, Take that whole code and put it inside the new vbcms_widget_weather template
Then create your static html widget and copy that same code into Configure.
If you have more than one forum skin, you'll have to create a vbcms_widget_weather for each template.
For instance, I have 11 skins so I had to make 11 new templates but configure the widget only one time.
You might want to add a TXT file to the first post with the instructions in it. That way they will have it in case they need to re-install it, for whatever reason, sometime in the future.
<span style="text-decoration: line-through">Sorry, I'm a little confused on how to implement this.
I have added the zip code field, and modified the code with the correct field number. I also created a new style named vbcms_widget_weather and created the new widget.
I am stuck on two things: 1) Insert the following into the new template, and 2)Configure the widget to use the "vbcms_widget_weather" template.
Where do you insert the code into the new template? I am using VB 4, and it looks like the "main css" area is no longer supported. Do I need to upload an XML file?
And then after that is done, how do I link the style with the widget?</span>
Edit:
I figured it out. I was going to delete this, but in case anyone has the same problem, I will explain what I did.
I was confusing "new style" with "new template" for an existing style. If you go to Style Manager > Drop-down menu for your current style > Add new template, you will be able to add vbcms_widget_weather and paste the code into the large text box.
Then, when you create the new widget, click Configure. Once again paste the code into this text box (I'm not sure why it needs to be in both places, but I just started using vbulletin today so I am very new). Then below the Static html box, there is a "template name" field. Paste vbcms_widget_weather into this field.
[S]Sorry, I'm a little confused on how to implement this.
I have added the zip code field, and modified the code with the correct field number. I also created a new style named vbcms_widget_weather and created the new widget.
I am stuck on two things: 1) Insert the following into the new template, and 2)Configure the widget to use the "vbcms_widget_weather" template.
Where do you insert the code into the new template? I am using VB 4, and it looks like the "main css" area is no longer supported. Do I need to upload an XML file?
And then after that is done, how do I link the style with the widget?[/S]
Edit:
I figured it out. I was going to delete this, but in case anyone has the same problem, I will explain what I did.
I was confusing "new style" with "new template" for an existing style. If you go to Style Manager > Drop-down menu for your current style > Add new template, you will be able to add vbcms_widget_weather and paste the code into the large text box.
Then, when you create the new widget, click Configure. Once again paste the code into this text box (I'm not sure why it needs to be in both places, but I just started using vbulletin today so I am very new). Then below the Static html box, there is a "template name" field. Paste vbcms_widget_weather into this field.
That totally cleared any problem I was having. Thanks a lot.
Edit:
I figured it out. I was going to delete this, but in case anyone has the same problem, I will explain what I did.
I was confusing "new style" with "new template" for an existing style. If you go to Style Manager > Drop-down menu for your current style > Add new template, you will be able to add vbcms_widget_weather and paste the code into the large text box.
Then, when you create the new widget, click Configure. Once again paste the code into this text box (I'm not sure why it needs to be in both places, but I just started using vbulletin today so I am very new). Then below the Static html box, there is a "template name" field. Paste vbcms_widget_weather into this field.
You don't need it in both places.
I copied this into the widget which I think just calls out the template.