scriptExtensionUrl

In many websites you want to extend your functionality with 3:rd party widgets. There are literally hundreds of throusands small javascript-packages available for download all over the web. A great thing we included since Infoglue 3.0 is the possibility to use these as normal assets. That is - you don't need to ftp them to a different server or to all live-servers etc but instead you can upload the entire widget package (often a zip-file) as a digital asset in any Infoglue component and then use this new tag to have it deployed and usable in the components on your site. Minimal effort.

Parameters

Name Required Default Type Description
Parameters
id false    Object/String  The id to keep the result in.
contentId false    Object/String  The content on which the script-zip is uploaded.
assetKey false    Object/String The asset key for the script-zip
fileNames false    Object/String State here which files you want to be references in the HTML. .js-filenames and .css-filenames is supported.
autoCreateMarkup false true Boolean If set to true the tag will produce complete html-tags for including the files specified.
addToHTMLHeader false false Boolean If set to true the resulting html will be put in the html head and not in the component output.
addToHTMLBody false false Boolean If set to true the resulting html will be put last in the html-body (as recommended in some cases for javascript-libs to minimize load time)
addToBundledIncludes false false Boolean If set  to true the files will be added in a common bundle-file which will contain minified versions of the files.
bundleName false   Object/String You can have different bundle-namespaces if you set this.

 

Example

In this example we want to use the eminent jquery-based colorbox plugin. We just download it from the official site and upload the same file as an asset to the component which should use it. Then the new tag does it's magic.

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="infoglue-content" prefix="content" %>

<%-- This row fixes all the magic as long as the colorbox.zip was uploaded to the component running the code with the asset key "colorbox". All HTML for including the needed files gets put in the html-header. --%>
<content:scriptExtensionUrl id="test" assetKey="colorbox" addToHTMLHeader="true" fileNames="colorbox/colorbox/jquery.colorbox-min.js,colorbox/example3/colorbox.css"/>

<%-- Now we can focus on using the new scripts. OBS - we left out all logic for iterating and showing the gallery images in the example. --%>

<script type="text/javascript">
<!--    
$(document).ready(function(){
    $("a[rel='gallery']").colorbox({transition:"none", width:"75%", height:"75%"});
});
-->
</script>

 



 



comments powered by Disqus