• Hi all, not 100% knowledgable on php etc but I wanted to make a widget and found a short tutorial on making a one Here

    The problem is how do I include javascript into the widget php code? can I just paste the script at the point it says

    // WIDGET CODE GOES HERE
        echo "<h1>This is my new widget!</h1>";
    
        echo $after_widget;

    So effectively what I want to do is remove the echo code and replace it with this:

    <script type="text/javascript"> moDays=3; moColourScheme="default"; moFSSI=324204; moDomain="www.metoffice.gov.uk"; moMapDisplay="none"; moMapsRequired=""; moTemperatureUnits="F"; moSpeedUnits="M"; moShowWind="true"; moShowUV="true"; moShowFeelsLike="true"; moAllowUserLocation="true"; moStartupLanguage="en"; moSpecificHeight="250"; moSpecificWidth="300"; </script><script type="text/javascript" src="http://www.metoffice.gov.uk/public/pws/components/yoursite/loader.js"> </script><p>This <a href='http://www.metoffice.gov.uk/services/weather-widget' >Weather Widget</a> is provided by the <a href='http://www.metoffice.gov.uk' >Met Office</a></p>

    A bit Heath Robinson eh! would that work or am I way ahead of myself?

  • The topic ‘Making a widget and javascript’ is closed to new replies.