Setting the Image Path

For your javascript to be able to load images it needs to know the correct path from the web root, this variable is available as a JavaScript global. To see default js globals just view source of any page generated by Seagull:

<script type="text/javascript"> <!--
        var SGL_JS_WEBROOT="http://localhost/seagull/branches/0.6-bugfix/www";
        var SGL_JS_WINHEIGHT=500;
        var SGL_JS_WINWIDTH=600;
        var SGL_JS_SESSID="";
        var SGL_JS_CURRURL="/seagull/branches/0.6-bugfix/www/index.php/mymodule/mymanager/action/view/";
        var SGL_JS_THEME="my_theme";
        var SGL_JS_DATETEMPLATE="%d %B %Y, %H:%M";
//--> </script>

In this example we are interested in both SGL_JS_WEBROOT and SGL_JS_THEME.

To set the correct path in your custom javascript files, just use these two javascript globals as follows (example taken from lightbox.js):

 * Configuration
var fileLoadingImage = SGL_JS_WEBROOT + "/themes/" +SGL_JS_THEME +"/images/loading.gif";
var fileBottomNavCloseImage = SGL_JS_WEBROOT + "/themes/" +SGL_JS_THEME +"/images/closelabel.gif";

If you have some specific module images located in <moduleName>/www/images simply call

var imagePath = SGL_JS_WEBROOT + "/moduleName/images/image.gif";

See Also