I'm looking to call my scripts through an apex:component. So instead of having 3 includes on my page, I want
<c:scripts />
and the 'scripts' component will contain the following.
<apex:component >
<apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/jquery-1.9.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/jquery-ui-1.10.3.custom.min.js') }" />
<apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/anotherScript.js') }" />
</apex:component>
But if I only want one of these scripts, can I pass a argument into the component call? Something like the following...
<c:scripts
myScript = true />
And then the component...
<apex:component >
Boolean myScript = <apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/jquery-1.9.1.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/jquery-ui-1.10.3.custom.min.js') }" />
<apex:includeScript value="{!URLFOR($Resource.jQuery, 'jQuery/js/anotherScript.js') }" />
</apex:component>
Is there an elegant way of doing this?
Cheers