[PHP] why this doesn't work as an external file but does internally?
Hi guys, I have this code Javascript code: if (document.images) { img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; img2on = new Image(); img2on.src = ?php echo $base_url; ?Graphics/?php echo $img_programdetails_on; ?; img3on = new Image(); img3on.src = ?php echo $base_url; ?Graphics/?php echo $img_products_on; ?; img4on = new Image(); img4on.src = ?php echo $base_url; ?Graphics/?php echo $img_featuredproducts_on; ?; img5on = new Image(); img5on.src = ?php echo $base_url; ?Graphics/?php echo $img_faq_on; ?; img6on = new Image(); img6on.src = ?php echo $base_url; ?Graphics/?php echo $img_contact_on; ?; img1off = new Image(); img1off.src = ?php echo $base_url; ?Graphics/?php echo $img_home_off; ?; img2off = new Image(); img2off.src = ?php echo $base_url; ?Graphics/?php echo $img_programdetails_off; ?; img3off = new Image(); img3off.src = ?php echo $base_url; ?Graphics/?php echo $img_products_off; ?; img4off = new Image(); img4off.src = ?php echo $base_url; ?Graphics/?php echo $img_featuredproducts_off; ?; img5off = new Image(); img5off.src = ?php echo $base_url; ?Graphics/?php echo $img_faq_off; ?; img6off = new Image(); img6off.src = ?php echo {$base_url}Graphics/{$img_contact_off}; ?; } When I include it in the main page it works without any problems. When I link it as an external file it doesn't work. As a side note, the following code example works in an external JS file: img1off = new Image(); img1off.src = ?php echo $base_url; ?Graphics/home_off.gif; Anyone know why the external file with two variables is not working but it does work with one variable? Thanks! I appreciate the help! Regards, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why this doesn't work as an external file but does internally?
Aaron Wolski wrote: Hi guys, I have this code Javascript code: snip When I include it in the main page it works without any problems. When I link it as an external file it doesn't work. As a side note, the following code example works in an external JS file: img1off = new Image(); img1off.src = ?php echo $base_url; ?Graphics/home_off.gif; Anyone know why the external file with two variables is not working but it does work with one variable? What is doesn't work? Does it not output the second variable? Does it output php code? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why this doesn't work as an external file but does internally?
[snip] I have this code Javascript code: [/snip] And the web has these JavaScript lists! Quaint, no? Anyhow, to make this work you will need to generate your JavaScript code with PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why this doesn't work as an external file but does internally?
-Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: October 5, 2004 3:52 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] why this doesn't work as an external file but does internally? [snip] And the web has these JavaScript lists! Quaint, no? [/snip] If you look closely, it's tied in with PHP. But thanks your help! [snip] Anyhow, to make this work you will need to generate your JavaScript code with PHP. [/snip] If that was true then why does this work: img1off = new Image(); img1off.src = ?php echo $base_url; ?Graphics/home_off.gif; I certainly didn't generate it with PHP and it was included as an external file. Thanks! A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why this doesn't work as an external file but does internally?
[snip] If that was true then why does this work: img1off = new Image(); img1off.src = ?php echo $base_url; ?Graphics/home_off.gif; I certainly didn't generate it with PHP and it was included as an external file. [/snip] If this is true then your problem is solved. if not echo img1off = new Image(); img1off.src = . $base_url . Graphics/home_off.gif; I think I have the syntax correct -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why this doesn't work as an external file but does internally?
Please reply to the list, and not just an individual person. Aaron Wolski wrote: -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: October 5, 2004 3:51 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] why this doesn't work as an external file but does internally? What is doesn't work? Does it not output the second variable? Does it output php code? When I say it doesn't work, the images don't appear. It's a simply mouseover effect: image on and image off type of thing. When the page loads... the main image (the off image) is visible but when I move the mouse over an image it just shows blank (an X). Does that make it more clear? Sorry. No. I turn my radio on, but it doesn't work, what's the problem? See what I mean? The question doesn't supply enough information to make an educated guess as to what the problem may be. What error messages are produced? What does the remotely included file output? Does the second variable have value? Can you provide a link to where we can see the issue at play? So on, and so forth. Look at the source of your page that doesn't work, where the JS is supposed to be, and chances are, you'll see the problem. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why this doesn't work as an external file but does internally?
Hi guys, I have this code Javascript code: if (document.images) { img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; img2on = new Image(); img2on.src = ?php echo $base_url; ?Graphics/?php echo $img_programdetails_on; ?; snip Regards, Aaron When you mix PHP and javascript together in an external file, the file needs to be PHP and you should include it with PHP. I just recently went through this. I had an external javascript file with some PHP in it. It was originally called into the index.php page as: script type=text/javascript src=includes/links.js But none of the PHP in the links.js worked. So I renamed the file to links.php and called it in index.php like so: ?php include 'includes/links.php'; ? And everything worked perfectly. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why this doesn't work as an external file but does internally?
File with the JS code is called: jsstuff.php Aaron -Original Message- From: Vail, Warren [mailto:[EMAIL PROTECTED] Sent: October 5, 2004 4:12 PM To: 'Aaron Wolski'; 'Jay Blanchard'; [EMAIL PROTECTED] Subject: RE: [PHP] why this doesn't work as an external file but does internally? Right on, a .js file is probably not processed by the PHP engine, but while it's imbedded in a .php file, it is. Apples and Oranges, no? Warren Vail -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 1:01 PM To: 'Jay Blanchard'; [EMAIL PROTECTED] Subject: RE: [PHP] why this doesn't work as an external file but does internally? -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: October 5, 2004 3:52 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] why this doesn't work as an external file but does internally? [snip] And the web has these JavaScript lists! Quaint, no? [/snip] If you look closely, it's tied in with PHP. But thanks your help! [snip] Anyhow, to make this work you will need to generate your JavaScript code with PHP. [/snip] If that was true then why does this work: img1off = new Image(); img1off.src = ?php echo $base_url; ?Graphics/home_off.gif; I certainly didn't generate it with PHP and it was included as an external file. Thanks! A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] why this doesn't work as an external file but does internally?
-Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: October 5, 2004 4:06 PM To: PHP Mailing Lists Subject: Re: [PHP] why this doesn't work as an external file but does internally? Please reply to the list, and not just an individual person. No. I turn my radio on, but it doesn't work, what's the problem? See what I mean? The question doesn't supply enough information to make an educated guess as to what the problem may be. What error messages are produced? What does the remotely included file output? Does the second variable have value? Can you provide a link to where we can see the issue at play? So on, and so forth. Look at the source of your page that doesn't work, where the JS is supposed to be, and chances are, you'll see the problem. Ok.. here are 3 links: https://celestica.tristarpromotions.com/NEW/index2.php This link... you'll see that the rollover effects on the top menu work. The external JS file (called: jsstuffnew.php) has code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/home_on.gif; https://celestica.tristarpromotions.com/NEW/index.php This link... you'll see that the rollover effects on the top menu DO NOT work. The external JS file (called: jsstuff.php) has code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; As you can see, the difference between the two is the fact that the image FILE NAME is hard coded into the file as opposed to calling. https://celestica.tristarpromotions.com/NEW/index3.php This link... you'll see that the rollover effects work as well. Instead of having an external file I have embedded the JS code directly into the page. Additionally, I have use code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; Having visuals... does that help communicate what the problem is? In terms of what errors I am seeing, etc... I cannot tell you that because NO errors come up at all, even with the external pages. Thanks John. Hope I explained it a bit better this time around. Regards, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why this doesn't work as an external file but does internally?
* Thus wrote Aaron Wolski: What error messages are produced? What does the remotely included file output? Does the second variable have value? Can you provide a link to where we can see the issue at play? So on, and so forth. Look at the source of your page that doesn't work, where the JS is supposed to be, and chances are, you'll see the problem. Ok.. here are 3 links: https://celestica.tristarpromotions.com/NEW/index2.php This link... you'll see that the rollover effects on the top menu work. The external JS file (called: jsstuffnew.php) has code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/home_on.gif; https://celestica.tristarpromotions.com/NEW/index.php This link... you'll see that the rollover effects on the top menu DO NOT work. The external JS file (called: jsstuff.php) has code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; $base_url and $img_home_on have no value in jsstuff.php thus you have a javascript that results in: img1on.src = Graphics/ Also, you should also send a javascript header with the jsstuff.php file: header('Content-Type: application/x-javascript'); Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why this doesn't work as an external file but does internally?
Aaron Wolski wrote: Ok.. here are 3 links: https://celestica.tristarpromotions.com/NEW/index2.php This link... you'll see that the rollover effects on the top menu work. The external JS file (called: jsstuffnew.php) has code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/home_on.gif; https://celestica.tristarpromotions.com/NEW/index.php This link... you'll see that the rollover effects on the top menu DO NOT work. The external JS file (called: jsstuff.php) has code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; As you can see, the difference between the two is the fact that the image FILE NAME is hard coded into the file as opposed to calling. https://celestica.tristarpromotions.com/NEW/index3.php This link... you'll see that the rollover effects work as well. Instead of having an external file I have embedded the JS code directly into the page. Additionally, I have use code that looks like: img1on = new Image(); img1on.src = ?php echo $base_url; ?Graphics/?php echo $img_home_on; ?; Having visuals... does that help communicate what the problem is? Yes, the output of your JavaScript in the second example is missing $img_home_on (it's outputting nothing). Where does this variable get set? How about posting the php code for https://celestica.tristarpromotions.com/NEW/jsstuff.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php