Adding a widget to the sidebar

Topics: Developer Forum, User Forum
Jun 17, 2009 at 1:18 PM

I'm customising a MWPSK for a friend of mine and I've hit a slight issue.

I'm using an ASP.NET widget that shows the current weather for a particular city in Greece - and when I load this up in a simple HTML page it all works just fine. What I'm trying to do is have this added below the Navigation bars on the Sidebar on the MWPSKpages; except everything I'm trying is not working. I've also extended the site using Custom Sidebar HTML from BurstMode (http://burstmode.de/BlogSearch.aspx?tag=MWPSKex.%23005) and have tried to embed it this way by editing the source code for the HTML area just below the nav bars. Not working.

I think this is relatively easy to resolve although I'm not a C# programmer by trade, so am more than likely overlooking something.

Is there a simple way to have this weather widget show up on every page, just below the nav bar?

The code that works in a simple HTML page load is:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Ajax Weather</title>
    <link rel="stylesheet" type="text/css" href="css/weatherwidget.css"/>
    <script type="text/javascript" src="js/zxml.js"></script>
    <script type="text/javascript" src="js/weatherwidget.js"></script>
    <script type="text/javascript">
    function init() {
		var divMyWeather = document.getElementById("myWeather");
        var oWeather = new AjaxWeatherWidget(divMyWeather);
    }
    
    onload = init;   
    </script>
</head>
<body>
	<div id="myWeather"></div>
</body>
</html>

 

Can anyone shed some light on where I'm going wrong please?

Thanks in advance,

David

 

 

Jun 17, 2009 at 1:20 PM

Forgot to ask... would creating a module or EasyControl perhaps be a better way of doing what I'm trying to achieve? (just thinking out loud...)

Thanks,

David

Jun 23, 2009 at 9:47 AM
Edited Jun 23, 2009 at 9:51 AM

Try using an IFRAME

I use them to add an asp newsletter application that uses javascript in a way that would break the asp.net application (MWPSK).

 

You can see it in action at http://WebmasterNotRequired.com I use it on the sign up form which shows up under the blog titles.

Read up on all of the IFRAME attributes and you add it via the HTML editors included with MWPSK

 

Jun 23, 2009 at 11:27 AM

Hi tinwistle,

Sorry, I should have replied to my own thread a couple of days ago - I found the solution without changing any of the above code or using iFrames.

One issue was that the site was throwing up an exception stating that I was inserting potentially dangerous code - got around this by using the Validate=False method.

Another issue I had was that the widget would work for a while and then fail.....

I was trying to figure this out and was deleting the various files for the weather widget and then adding them back in again (then changing the weather paremeters etc) and I noticed the weather would display on the first page load, but not again 30 mins later... so it got me thinking: the widget itself uses a file that contains a timestamp within it that records when the last fetch from the XML feed was performed (the license states that I can only grab the updated feed every 30 minutes) - so if 30 minutes had not passed, then it shows the locally cached info from the last 'get'; if more than 30 mins it fetches an update and writes the timestamp tot he above mentioned file.

The problem here was permissioning on the cache file that records the timestamp - the ASPNET user did not have write access to this file and therefore couldn't update it and subsequently the weather widget 'failed' and was not displayed.

Thanks for getting back to me anyway - help is always appreciated!

David