Help With PHP & Javascript

Reply

Join Date: Oct 2006
Posts: 75
Reputation: welbyobeng is an unknown quantity at this point 
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Help With PHP & Javascript

 
0
  #1
May 10th, 2007
There is a script I am using....A Media Gallery...everytime I put in a javascript, it does not work. When I put

<script type="text/javascript"
src="http://www.example.com/js/swfobject.js">
</script>
<script language="javascript"
src="http://www.example.com/js/player.js">
</script>
<script language="javascript">
var config = new Array();
config["width"] = 400;
config["height"] = 300;
config["clientId"] = "example";
config["bgColor"] = "#FFFFFF";
config["playList"] = "1191";
showSanagaPlayer(config);
</script>
I recieve this when I view the source of the script

<script type="text/javascript"<br />
src="<A href="http://www.example.com/js/swfobject.js"><br">http://www.example.com/js/swfobject.js"><br />
</script><br />
<script language="javascript"<br />
src="<A href="http://www.example.com/js/player.js"><br">http://www.example.com/js/player.js"><br />
</script><br />
<script language="javascript"><br />
var config = new Array();<br />
config["width"] = 400;<br />
config["height"] = 300;<br />
config["clientId"] = "example";<br />
config["bgColor"] = "#FFFFFF";<br />
config["playList"] = "1191";<br />
showSanagaPlayer(config);<br />
</script>
Is there anything I can do for it to ignore <br />
Note...the script was intended for html
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 223
Reputation: Anonymusius is on a distinguished road 
Solved Threads: 10
Anonymusius's Avatar
Anonymusius Anonymusius is offline Offline
Posting Whiz in Training

Re: Help With PHP & Javascript

 
0
  #2
May 11th, 2007
It looks to me like you entered this somewhere in your mediagalary, but that it got parsed. To because that a tag was wrapped around the URL's. Bit weird is the <br"> and that it didn't close the a tag, if it were a parser.

So I ask you, did you nativly pasted this into PHP like:
[php]
<?php
//code here
?>
<script type="text/javascript"
src="http://www.example.com/js/swfobject.js">
</script>
<script language="javascript"
src="http://www.example.com/js/player.js">
</script>
<script language="javascript">
var config = new Array();
config["width"] = 400;
config["height"] = 300;
config["clientId"] = "example";
config["bgColor"] = "#FFFFFF";
config["playList"] = "1191";
showSanagaPlayer(config);
</script>
<?php
//code here
?>
[/php] or did you enter this somewhere in a form in the media galary your using. If you didn't enter it in a form it's still theoraticly possible to style it with ob_start() and output buffer functions, seems unlikely though. You might wanna add what gallery your using.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 75
Reputation: welbyobeng is an unknown quantity at this point 
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Re: Help With PHP & Javascript

 
0
  #3
May 11th, 2007
When I add this to the form in the php scripts which is
<script type="text/javascript"
src="http://www.example.com/js/swfobject.js">
</script>
<script language="javascript"
src="http://www.example.com/js/player.js">
</script>
<script language="javascript">
var config = new Array();
config["width"] = 400;
config["height"] = 300;
config["clientId"] = "example";
config["bgColor"] = "#FFFFFF";
config["playList"] = "1191";
showSanagaPlayer(config);
</script>
I recieve this when I view the source of the website I get
<script type="text/javascript"<br />
src="<A href="<A href="http://www.example.com/js/swfobject.js"><br">http://www.example.com/js/swfobject.js"><br">
</script><br />
<script language="javascript"<br />
src="<A href="<A href="http://www.example.com/js/player.js"><br">http://www.example.com/js/player.js"><br">
</script><br />
<script language="javascript"><br />
var config = new Array();<br />
config["width"] = 400;<br />
config["height"] = 300;<br />
config["clientId"] = "example";<br />
config["bgColor"] = "#FFFFFF";<br />
config["playList"] = "1191";<br />
showSanagaPlayer(config);<br />
</script>
I think there must be a code in the php that adds <br /> when I put in my code
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: Help With PHP & Javascript

 
0
  #4
May 11th, 2007
Where are you putting in the JS script? Directly into a PHP file? HTML file?
Are you entering it via a form?

The New Lines are being parsed into <br /> tags somewhere..
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 75
Reputation: welbyobeng is an unknown quantity at this point 
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Re: Help With PHP & Javascript

 
0
  #5
May 11th, 2007
I am entering into a form a form...
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 75
Reputation: welbyobeng is an unknown quantity at this point 
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Re: Help With PHP & Javascript

 
0
  #6
May 11th, 2007
I have included an attachment of the index.php and some of the main files that can contain The New Lines being parsed into <br /> tags somewhere.... I have tried messing with it but no luck. Can someone help
Attached Files
File Type: zip files.zip (158.1 KB, 0 views)
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: Help With PHP & Javascript

 
0
  #7
May 11th, 2007
The form handler uses the function nl2br() on the content it receives.
You'll have to remove that or upload your script via ftp or some other method.

or

Put the JS in a file and upload the file anywhere on the web.

Plase <script src="http://example.com/js_file.js"></script>

in the form you're using. make sure it links to the js file. That way the form won't corrupt your js.

what gallery are you using by the way. It is a stand alone gallery or on top of another app?
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 75
Reputation: welbyobeng is an unknown quantity at this point 
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Re: Help With PHP & Javascript

 
0
  #8
May 11th, 2007
I am using Photokorn Media Gallery.. I have posted some files that might contain it. Can you help me to remove function nl2br() from the script.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 75
Reputation: welbyobeng is an unknown quantity at this point 
Solved Threads: 0
welbyobeng welbyobeng is offline Offline
Junior Poster in Training

Re: Help With PHP & Javascript

 
0
  #9
May 13th, 2007
Can someone help with the script
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,075
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: Help With PHP & Javascript

 
0
  #10
May 14th, 2007
In the form you are uploading your script, look at the HTML source. The form will have an "action" attribute. This points to the form handler. This file is the one thats changing the code you're putting in. Post the file contents here or put it in a text editor and search for nl2br.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC