andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


An Error

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> MadLibs
View previous topic :: View next topic  
Author Message
meekar
Newbie


Joined: 29 Jun 2005
Posts: 3

PostPosted: Wed Jun 29, 2005 7:11 pm    Post subject: An Error Reply with quote

I have installed both 'Choose a Story' and 'Use Tags More Than Once' modifications to the script, and they work great togethor. But I have one problem. I submitted one phrase which had a " ' " in it, which gave out in the final story a " \' " Any ideas why this could've occured? The program is supposed to take ' \ ' out, right?
Back to top
View user's profile Send private message AIM Address
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Thu Jun 30, 2005 7:07 am    Post subject: Reply with quote

Hi meekar, and welcome to the baord!

It occurs because of the magic_quotes setting. If this is on, then any value through post or get will have quotes delimited. You could adjust your settings, but the easiest way by far is just to change this line i nthe replaceTags method:

PHP:
<?php $this->outText['story'] = substr_replace($this->outText['story'], '<span class="madlibWord">' $word_list[$position] . '</span>'$positionstrlen($tag)); ?>


with this:

PHP:
<?php $this->outText['story'] = substr_replace($this->outText['story'], '<span class="madlibWord">' stripslashes($word_list[$position]) . '</span>'$positionstrlen($tag)); ?>


The only bit to change there is stripslashes($word_list[$position]).

Hope that helps!

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
meekar
Newbie


Joined: 29 Jun 2005
Posts: 3

PostPosted: Sat Jul 02, 2005 3:34 pm    Post subject: Reply with quote

Ok, I have it looking like this:

PHP:
<?php $this->outText['story'] = substr_replace($this->outText['story'], '<span class="madlibWord">' stripslashes($word_list[$position]) . '</span>'$positionstrlen($tag)); ?>


...in the class.madlibs.php file, but when I enter a " ' " the same thing happens.
Back to top
View user's profile Send private message AIM Address
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Sat Jul 02, 2005 5:39 pm    Post subject: Reply with quote

meekar wrote:
I have installed both 'Choose a Story' and 'Use Tags More Than Once' modifications to the script


If you have done the above as I posted, as an extension to the main madlibs class, then you'll have to add the stripslashes to the version of the replaceTags method that you find in there, not in the main madlics class (though if you have added it there you may as well leave it, but just make sure you add it to the extension class, too).

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
meekar
Newbie


Joined: 29 Jun 2005
Posts: 3

PostPosted: Tue Jul 05, 2005 2:03 pm    Post subject: Reply with quote

Ah, ok, thanks, that was stupid of me. It works great now! Now I'm going to finish this off with a great big thankyou and say, "This is a great script and it is also a great feature for my site!" Keep up the good work Smile
Back to top
View user's profile Send private message AIM Address
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Tue Jul 05, 2005 2:14 pm    Post subject: Reply with quote

Thanks! Glad you got it working. Smile

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> MadLibs All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group