JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 13th, 2001, 11:25 AM
giuli4n0t giuli4n0t is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Italy
Posts: 16 giuli4n0t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 46 sec
Reputation Power: 0
Send a message via MSN to giuli4n0t
Unhappy PHP and Javascript

Hi all,
I'm in front of a strange problem that I'll try to explain.

I'm using PhpNuke and I wish to do the following thing. I wish to include an external javascript and it's quite simple to do it in Php:
PHP Code:
echo "<script language=\"Javascript\" src=\"external.js\"></script>"


The problem is this: I wish to set a variable for the external JS which has to be parsed first from Php.

Just to clear my intent:

Code:
// this is my external.js

function Ripristina() {
document.form.monitor.value=""+varText;
}


How can I define varText in php?
I am asking that as I try (with no results) this way:
PHP Code:
echo "<script language=\"Javascript\" src=\"external.js\">\n";
$varText translate("Bla bla");
echo 
"varText = \"$varText\"\n";
echo 
"</script>"


I hope there is someway else to do this trick and I hope someone more expert than me knows how.

Regards.

Reply With Quote
  #2  
Old July 13th, 2001, 11:39 AM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
F*CK. Sorry, but the software running this forum once again crashed when parsing my post, and naturally, going back doesn't work on this bloody site, so my post was lost. Goddamn.

Anyway. What you need to do is this (pseudo code):
1. Print out a script type="javascript" tag in which you set your javascript variable.
2. Print out another script tag like the one you're using now, with the source.

Do it in that order, you need to make sure that the javascript variable becomes available in the referenced js file.

Reply With Quote
  #3  
Old July 13th, 2001, 12:14 PM
giuli4n0t giuli4n0t is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Italy
Posts: 16 giuli4n0t User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 46 sec
Reputation Power: 0
Send a message via MSN to giuli4n0t
Wink

Thanks.

It solved my problem.

Why didn't I think about it before?


Thanks for your suggestion.

Bye.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > PHP and Javascript

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap