Re: Javascript & PHP

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

 



use php to output the javascript code just as u'd do it for html
(since the javascript code is IN the html).
if ur js is ready:
<?php
echo <<<JS_TEXT
<script language="javascript"><!--
...
//--></script>
JS_TEXT;
?>
the <script> part could be the code or a link to the file which u'd use as
<link rel=...>

[some trivial stuff]
u can do this even if the javascript section is dynamic...u've used
variables in such a way that u repeat code for each section in the
page and the number of sections is dynamic.
[/some trivial stuff]

On Mon, 28 Feb 2005 01:18:15 +0000, timothy johnson
<mr2bigjohnson@xxxxxxxxx> wrote:
> I am trying to make a small menu system using javascript, but the
> values that I want to use come from php/mysql. I can get the code to
> work when I type in the values but when I try to use php. it doesnt
> process the php. you view source and you can see the php functions. I
> have tried naming the file different types like php, html,
> js.php....nothing is working. How can I use php to output javascript
> vars?
> 

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

-- 
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