Including JS code that uses PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have some javascript code that has PHP in it like this:

var CLIENT_ID='<?php echo $CLIENT_ID; ?>'

If I put the JS code directly in a php file with:

  <script type="text/javascript">
      .
      .
      .
  </script>

Then at run time CLIENT_ID has the value I want. I want to use the
same JS code in many php files. But if I include the JS code like
this:

  <script src="login.js" type="text/javascript">

Then that php code does not get run and CLIENT_ID has the literal
string '<?php echo $CLIENT_ID; ?>'

Is there a way I can reuse my JS file and still have embedded PHP in it?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux