943,935 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1837
  • PHP RSS
May 10th, 2007
0

Help With PHP & Javascript

Expand Post »
There is a script I am using....A Media Gallery...everytime I put in a javascript, it does not work. When I put

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

Quote ...
<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
Similar Threads
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
May 11th, 2007
0

Re: Help With PHP & Javascript

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.
Reputation Points: 129
Solved Threads: 11
Posting Whiz in Training
Anonymusius is offline Offline
223 posts
since Aug 2006
May 11th, 2007
0

Re: Help With PHP & Javascript

When I add this to the form in the php scripts which is
Quote ...
<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
Quote ...
<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
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
May 11th, 2007
0

Re: Help With PHP & Javascript

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..
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
May 11th, 2007
0

Re: Help With PHP & Javascript

I am entering into a form a form...
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
May 11th, 2007
0

Re: Help With PHP & Javascript

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, 17 views)
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
May 11th, 2007
0

Re: Help With PHP & Javascript

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?
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
May 11th, 2007
0

Re: Help With PHP & Javascript

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.
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
May 13th, 2007
0

Re: Help With PHP & Javascript

Can someone help with the script
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
welbyobeng is offline Offline
75 posts
since Oct 2006
May 14th, 2007
0

Re: Help With PHP & Javascript

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.
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: placing site
Next Thread in PHP Forum Timeline: small question please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC