[eluser]Bernat Bonet[/eluser]
I think my problem is the same, then I'll explain it:
I want to generate js file from php file, I mean, I've php file that generate js file calling database and codeigniter core.
The generated file have to be accesed from view.
The problem is how I generate js file from interpreted php file ?
View:
Code:
<html>
<head>
<title><?php echo $this->lang->line('login_titulo'); ?></title>
<link rel="stylesheet" type="text/css" href="/lib/extjs3.0/resources/css/ext-all.css" />
[script src="/lib/extjs3.0/adapter/ext/ext-base.js" type="text/javascript"][/script]
[script src="/lib/extjs3.0/ext-all.js" type="text/javascript"][/script]
[script src="/lib/extjs3.0/src/locale/ext-lang-<?= $this->config->item('language');?>.js" type="text/javascript"][/script]
[script src="login/login.php" type="text/javascript"][/script]
[script src="login/login_base.js" type="text/javascript"][/script]
</head>
<body>
</body>
</html>
PHP file to generate js file (login.php):
Code:
var login_form = new Ext.form.FormPanel({
labelWidth : 150,
url : 'login/validar',
frame : true,
title : '',
width : 230,
padding : 20,
defaultType : 'textfield',
monitorValid : true,
buttonAlign : 'center',
items : [{
fieldLabel : '<?=$this->lang->line("login_login_form_field_usename");?>',
name : 'username',
allowBlank : false
}, ...
Where to place php file, and how can we generate js/php file ?
Thanks a lot.