Re: Javascript & PHP
| From: | anirudh dutt | Date: | Mon, 28 Feb 2005 01:53:37 +0000 |
| Subject: | Re: Javascript & PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209563@lists.php.net to get a copy of this message | ||
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@gmail.com> 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