PHP and JavaScript: problem with echo()-ing unwanted line breaks
Hi, All.
I'm trying to use PHP to read data from file, and then write it into a JavaScript array (which will be used to create a "news-ticker" bar on the page). The problem is that the PHP echo() function is inserting unwanted line breaks after the quote-mark which starts a string, leading to an "unterminated string literal" error. Example: Code:
var storyLinks = new Array( "<?php global $lastThree; echo($lastThree[1][1]); ?>", Code:
var storyLinks = new Array( " Does anyone know a solution to this, please? Thanks, Rob PS - phpinfo() tells me that I'm using PHP 4.4.4 on Apache 1.3.33 (if that makes a difference). |
PHP Code:
|
and if that doesn't work:
PHP Code:
|
Thanks muchly - trim (or rather ltrim) was what I needed.
Yours, Rob |
All times are GMT -5. The time now is 06:36 AM. |