|
|
sNews, Javascript and PHP
|
|
|
Posted under General by Andrew on Tuesday June 26 2001 @ 04:59AM EDT
I am using the sNews addon (Javascript headlines) by chino. However, there is one problem with the script, it does not strip out (or escape/replace) " marks and other forbidden characters in Javascript.
Since I'm new to PHP, how can I get it to do this?
An excellent little addon. Lack of being able to offer Javascript headlines was one of the issues that was holding me up from using PHPweblog. My site supplies headlines to around a dozen or so other websites.
I've adapted the addon it so that I can offer headlines with a summary as well as plain headlines.
However, if there are quotation marks in the summary or headline it will (obviously) crash the Javascript.
|
chino writes on Wednesday June 27 2001 @ 02:38PM EDT: [ reply | parent ]
If you write a story with "", javascript sends you an error? I'll try. And i'll try to fix it. I dont know javascript, btw, ill try to fix it.
|
chino writes on Wednesday June 27 2001 @ 02:49PM EDT: [ reply | parent ]
I wrote a test story with "" in the title. There's no error. It's ok. See here a snapshot.
|
Andrew writes on Friday June 29 2001 @ 10:07PM EDT: [ reply | parent ]
Hmm, that's interesting, I don't see why javascript would do that?
If there are quotation marks in the summary (when I include it in the javascript headlines) it crashes the code. I hadn't actually tried it with quotation marks in the title as well, I dn't see why it wouldn't do the same thing there as well.
Weird.
|
Andrew writes on Friday June 29 2001 @ 10:09PM EDT: [ reply | parent ]
Ha !
Getting confused with my breaks :-)
|
chino writes on Saturday June 30 2001 @ 10:47AM EDT: [ reply | parent ]
it's ok now ?
|
Andrew writes on Sunday July 01 2001 @ 06:05PM EDT: [ reply | parent ]
No, I'm just having to make sure that no quotations marks go into the summary field or else the javascript will crash.
I can live with that, but I thought that there might have been a more elegant solution.
By the way, thanks for writing the sNews script, I have found it very useful. It clinched my migration over from flat text files to MySQL and PHPweblog.
|
|
|
|