Welcome Guest, Not a member yet? Register   Sign In
Parsing php in javascript
#2

[eluser]cahva[/eluser]
Well the easiest to do here would be to add a little inline js where you define APP_MAIN and APP_SITE before loading the scripts. So inside your layout/header view something like this should work:
Code:
<html>
<head>
< script>
var APP_MAIN = '<?php echo APP_MAIN ?>',
    APP_SITE = '<?php echo APP_SITE ?>';
< /script>
Now those global variables would be available in the other scripts:
Code:
content_css : APP_MAIN + "css/" + APP_SITE + ".css",


Messages In This Thread
Parsing php in javascript - by El Forum - 12-24-2010, 05:10 AM
Parsing php in javascript - by El Forum - 12-24-2010, 05:25 AM
Parsing php in javascript - by El Forum - 12-24-2010, 06:10 AM
Parsing php in javascript - by El Forum - 12-28-2010, 09:02 AM
Parsing php in javascript - by El Forum - 12-29-2010, 05:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB