[eluser]Jameson.[/eluser]
Well, you could make Apache treat those .js files as php scripts by adding a handler similar to this:
Code:
AddHandler application/x-httpd-php .js
But that's not really the right thing to do. I suppose that large .js file is some sort of library with all sorts of functions that are static and need not be changed often. So let's allow our client's browser to cache that .js file and only output dynamic variables in view.
We'll have to refactor js code a bit:
Code:
function startup(url, date)
{
$.post(
url + 'shipper/shipment/inbound_by_date', {
'date': date
}
}
and in view you would write somthing like this:
Code:
< script type='text/javascript'>
$(document).ready(function(){
startup('<?=$this->config->item("base_url")?>', '<?=$item['date_or_smth']?>');
})
< /script>
On a side note: personally I prefer to put all my static client-side resources in one folder, say "static", and then just refer it via relative path from domain root (don't know how to call it correctly in English), like this:
Code:
< script type='text/javascript' src='/static/js/common.js'>< /script>
This way I don't have to manually change references to files when using on another project and don't need to provide URL in program.