Board Logo

Extra "\" when using ' ?
yicktheman - 2/3/2006 at 11:16 PM

hey guys.... Well I got my php event calendar running real well on my website. You can check it out below... but one thing that is really starting to bug me is that whenever i enter in an event and use the apostrophe ( ' ) it types it out as " ' " for some unknow reason... It's probably a bug in the code somewhere but does this happen to anybody else? and does anybody have any tips on how to fix it? Thanks a lot


Zeeke75 - 2/20/2006 at 02:25 AM

Yeah, I had the same problem originally. I added the following code for the $body variable. The code below also allows for entering events with line breaks and have it display properly:

str_replace('$body', nl2br(str_replace("'", "'", $v->body)), $c);

You can do the same thing for the title:

$c = str_replace('$title', str_replace("'", "'", $v->title), $c);

Hope this helps!


skb - 2/20/2006 at 07:23 AM

I have the same problem and i just tried replacing the $body tag in the calendar.php but it didnt work. also the calendar.php has the $body twice in the file. i tried replacing both. PLEASE HELP!


Zeeke75 - 2/20/2006 at 01:09 PM

Hmm...not sure why that didn't work, but here's another option that should work:

echo str_replace('$body', nl2br(stripslashes($v->body)), $c);


skb - 3/16/2006 at 02:05 PM

what page do i make that change on to get that to work?


lintguy - 5/9/2006 at 12:13 PM

Quote:
Originally posted by skb
what page do i make that change on to get that to work?


here's what I did to fix the ' problem. It seems to be working fine.

1. Open Calendar.php in your cl_files directory.
2. Search for "function show_event()" and scroll down to "else $time = '&nbsp';"
3. under "else $time = '&nbsp';" add the following before any "echo" strings:

$c = str_replace('$title', nl2br(str_replace("'", "'", $v->title)), $c);
$c = str_replace('$body', nl2br(str_replace("'", "'", $v->body)), $c);

5. Remove the other entry for '$title' if it exists

That doesn't fix the problem in the control panel interface, but it fixes the live calendar.


XTinitus - 9/25/2006 at 02:41 AM

Wow, very useful! Thank's a lot. The Zeeke75 proposition worked at once.
BTW, for skb, the document to modify is "calendar.php" in the cl_files.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/