[eluser]GF[/eluser]
Hi there,
I'm a brand new CI user, and so far I have been very impressed with the CI framework. Getting my head around MVC is still confusing at times, but overall I see the benefits that CI offers.
However, one thing I still can't figure out is this. I would like to create a dynamically-generated JS file that uses $this->lang->line('some_content') from my Language file.
Specifically, in my template file, I'm using this snippet to produce any extra head content:
if (isset($extraHeadContent)) {
echo $extraHeadContent."\n";
}
The respective controller uses something like the following to reference the various JS files I need for the specific view:
$data['extraHeadContent'] = "";
$data['extraHeadContent'] .= "";
The username_text.php file, located at the /root/js/ folder, looks something like:
<?php
echo 'availText = "'.$this->lang->line("reg_username_available").'";';
echo 'notAvailText = "'.$this->lang->line("reg_username_not_available").'";';
?>
I've tried various approaches, but usually the error Firebug shows is that the $this-> variable is not used properly. I've tried putting the JS file (username_text.php) within the /system/application/ folder, but to no avail.
I'm sure I'm missing something really obvious. Any pointers in the right direction are greatly appreciated.
Blessings,
Graham