Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Weather Channel widget that uses members zip code Details »»
Weather Channel widget that uses members zip code
Version: 1.00, by benstillman benstillman is offline
Developer Last Online: May 2014 Show Printable Version Email this Page

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.


You can customize the Weather Channel widget including F/C, background image, etc: http://www.weather.com/services/oap/...r-widgets.html


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. View Post
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.

Screenshots

File Type: jpg weather_widget.JPG (51.0 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
WendM

Comments
  #22  
Old 01-05-2011, 02:06 PM
benstillman benstillman is offline
 
Join Date: Jun 2007
Location: Ohio
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Richard Evans View Post
How to you add the profile field (Zip Code). I am unfamiliar with where that is.
thanks in advance
admincp

User Profile Fields

Add profile field

http://yourwebsite.com/admincp/profilefield.php?do=add
Reply With Quote
  #23  
Old 01-05-2011, 02:12 PM
benstillman benstillman is offline
 
Join Date: Jun 2007
Location: Ohio
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by aenable View Post
FWIW, I had to change this line:
Code:
Add your <A HREF="{vb:raw vboptions.bburl}">$/profile.php?do=editprofile">Zip Code</A> to show weather forcast.
to this:
Code:
Add your <A HREF="{vb:raw vboptions.bburl}/profile.php?do=editprofile">Zip Code</A> to show weather forecast.
to fix the link in the widget when there is no zip code showing.

(VB4.0.7)

Thanks!
Fixed. Thanks!

Quote:
Originally Posted by Octavius. View Post
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.
Added your instructions to the original post.
Reply With Quote
  #24  
Old 01-07-2011, 12:23 AM
ThisIrksMe ThisIrksMe is offline
 
Join Date: Dec 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this not work for vB4.1PL2?
Reply With Quote
  #25  
Old 01-13-2011, 01:55 AM
kenmoresp kenmoresp is offline
 
Join Date: Jul 2010
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Question,
Will the work for 3.8.x ???
Reply With Quote
  #26  
Old 01-13-2011, 05:14 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #27  
Old 01-30-2011, 04:11 AM
expediteinsight expediteinsight is offline
 
Join Date: Jan 2011
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<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.
Reply With Quote
  #28  
Old 02-08-2011, 02:51 PM
benstillman benstillman is offline
 
Join Date: Jun 2007
Location: Ohio
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ThisIrksMe View Post
Does this not work for vB4.1PL2?
Works on my 4.1.1 dev site.
Reply With Quote
  #29  
Old 04-20-2011, 12:50 AM
rbc1225 rbc1225 is offline
 
Join Date: Feb 2010
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by expediteinsight View Post
[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.
Reply With Quote
  #30  
Old 07-09-2011, 04:48 PM
EdQ EdQ is offline
 
Join Date: Aug 2005
Location: Sunny San Diego
Posts: 158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by expediteinsight View Post

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.

PHP 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"

The I created the template as written, but I did it in my parent style so I didn't have to create it in all my styles.

It works. Thanks.
Reply With Quote
Благодарность от:
WendM
  #31  
Old 09-04-2011, 03:02 AM
jmp51483 jmp51483 is offline
 
Join Date: Aug 2011
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works well here thanks!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07025 seconds
  • Memory Usage 2,353KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete