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.


Help, help, help, please!!

 
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
neobrush
Newbie


Joined: 16 Jul 2004
Posts: 5

PostPosted: Fri Jul 16, 2004 10:14 am    Post subject: Help, help, help, please!! Reply with quote

I have just downloaded your main MadLibs file for my website. I wish to use the php file system to run it. I have been able to upload the file to a folder in my website. HOWEVER, nothing shows up at all on the page when I view it. I mean nothing, it's a blank screen totally. Sad

Am I supposed to modify the main file somehow to run it? Ripway, my host, does not yet offer MySQL database so I can't use that. Am I supposed to edit the php text somehow to get it to run? Sad

I even tried to upload it as an ASCII through an FTP server when the regular upload of the php file wouldn't work, but that doesn't work either. Crying or Very sad How do I get it to display and work properly as a file system, please? I know next to nothing about php, although have a decent working knowledge of html Embarassed so I don't have a clue how to fix this myself. Sad
Back to top
View user's profile Send private message
neobrush
Newbie


Joined: 16 Jul 2004
Posts: 5

PostPosted: Fri Jul 16, 2004 10:52 am    Post subject: I tried again Reply with quote

using the advice you posted in reply to the message titled ?? and this is what I get now on the page:

MadLibs! useFS('./stories', '.txt'); $ml->displayMadlib(); ?>

Crying or Very sad Crying or Very sad

Please, help!

oops, sorry, I should have edited the first message instead of posting a new message to it. Sorry!
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Fri Jul 16, 2004 1:41 pm    Post subject: Reply with quote

Hi neobrush, and welcome to the board! Smile

Here's a step-by-step guide on what to do. If it still doesn't work after this, then let me know what server your hosting account uses (Linux/Apache, Windows/Apache, Windows/IIS, etc.)

Save the files

Download all of the madlib files from the php.amnuts.com website, except for schema.sql, as we wont be needing that. This means that you will have 4 files downloaded.

Upload the files

Now connect to your hosting account to the directory you'd like to put the madlibs script. Just for the sake of arguement, I'm going to pretend it's in the folder '/home/neobrush/madlibs/'.

So upload 'class.madlibs.php' and 'test.madlibs.php' to that folder as ASCII files.

Create a folder in there called 'stories', so you'll have '/home/neobrush/madlibs/stories/' and upload the files 'example-story-beach.txt' and 'example-story-mall.txt' into it. At this stage you'll want to make sure that the stories folder and the files contained in it are accessable to the web server. You can sometimes do this with an option in your FTP program, you if you have access, log into the shell and use the chmod command.

Edit the test file

Now you'll want to open the 'test.madlibs.php' file to tweak it. You can either do this directly on the server, or on your local file and just upload over the server one again, it's up to you.

You'll be wanting to tweak the php block, which by default looks like this:

PHP:
<?php

    
require 'class.madlibs.php';

    
$ml = new madlibs();
    
$ml->useFS('.''.txt');
    
$ml->displayMadlib();

?>


You'll want to change it to:

PHP:
<?php

    
require 'class.madlibs.php';

    
$ml = new madlibs();
    
$ml->useFS('./stories''.txt');
    
$ml->displayMadlib();

?>


Save (and upload again if needs be), and now view the 'madlibs/test.madlibs.php' file in your browser. Do you see anything at all?

If not, we can try turning on error reporting to full and see if that helps. But for now, just try the above and let me know how you get on.

I apologise if you think these instructions are too simplistic, but I'm just trying to be as clear as possible.

Regards,

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


Joined: 16 Jul 2004
Posts: 5

PostPosted: Fri Jul 16, 2004 6:32 pm    Post subject: Thank you for replying so promptly! Reply with quote

I am going to go try that right now!! I see one thing I did very wrong, and that was I did not download all four files. My bad.

Please, don't apologize; yes, simplistic is good!! Simplistic is very good since I know nothing of php!!

I will try this tonight, and I will let you know if it works! Smile
Back to top
View user's profile Send private message
neobrush
Newbie


Joined: 16 Jul 2004
Posts: 5

PostPosted: Fri Jul 23, 2004 2:29 pm    Post subject: sorry Reply with quote

I tried it that night, and it didn't work. My regular work schedule got really very busy, so I couldn't get back to you until today. Sorry. I tried it again this p.m. and this is what I get:

Warning: main(class.madlibs.php): failed to open stream: No such file or directory in \\192.168.0.107\webfiles\files\2004-6\133421\MadLibs\test[1].madlibs.php on line 58

Fatal error: main(): Failed opening required 'class.madlibs.php' (include_path='.;c:\php\includes') in \\192.168.0.107\webfiles\files\2004-6\133421\MadLibs\test[1].madlibs.php on line 58

That is when I try and view it on my site. When I try and view it directly on my browser as you directed, all I see is the html and php codes on the screen.

So I don't know quite what I have done wrong. Now, when I view the story .txt files in my edit text mode on my server, I do see those. So I think my web server can access the stories. Still, something is wrong. Was I supposed to upload the example story text files in ASCII form? My CuteFTP doesn't seem to have chmod available, and I don't think Ripway which is my hosting service can allow me to use chmod anyway. I had just uploaded the two story files directly as I do all plain text files to their own subfolder under MadLibs.

Was I supposed to create a default web index.html page for the Madlibs folder? Is that what is going wrong? I really want to be able to get this working. I have registered as a member of Hotsccripts.com and would love to write a member review for you if I can ever get the class to work for my site.

I am not sure what server Ripway uses. I will contact their customer service support to find out.
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Fri Jul 23, 2004 5:07 pm    Post subject: Reply with quote

Hi neobrush,

The answer to this might be fairly simple. It's to do with the file names. You have uploaded the files called test[1]madlibs.php and class[1].madlibs.php. There is a line (number 58 ) in the test file that calls a file called 'class.madlibs.php'... Notice that there is no '[1]' in there? That's why you're getting this error:

neobrush wrote:
Warning: main(class.madlibs.php): failed to open stream: No such file or directory in \\192.168.0.107\webfiles\files\2004-6\133421\MadLibs\test[1].madlibs.php on line 58


Now, try renaming your files (you should be able to do this through CuteFTP) so that they don't have the '[1]' in there. You could actually call the test file anything you like, but if you call the class anything but 'class.madlibs.php' then you'll have to update the line that requires it, which looks something like:

Code:
require_once 'class.madlibs.php';


Hope this 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
neobrush
Newbie


Joined: 16 Jul 2004
Posts: 5

PostPosted: Fri Jul 23, 2004 5:20 pm    Post subject: Yes, Yes, Yes!!!! Reply with quote

Very Happy
Yes, that fixed it and it does display now!!!!
Now, one quick simple question, and then I'll be making a donation to your site for the program:

So, can I write other stories as new text files and just put them in as long as I include the tags and name the files as .txt files and put them in the stories subfolder so that there are more choices than just the two examples?

This will be a great addition to my site which is geared for children!!
Very Happy
Back to top
View user's profile Send private message
amnuts
Site Admin


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

PostPosted: Fri Jul 23, 2004 6:31 pm    Post subject: Re: Yes, Yes, Yes!!!! Reply with quote

Glad it worked. Smile Having error messages sure makes things easier!

neobrush wrote:
Now, one quick simple question


Ask as many as you need/want to!!

neobrush wrote:
can I write other stories as new text files and just put them in as long as I include the tags and name the files as .txt files and put them in the stories subfolder so that there are more choices than just the two examples?


Of course! Smile (Wouldn't be a very fun script otherwise Wink ) Just have a plain text file with the title of the story as the first line, and then the rest of the file as the story itself. There are a number of pre-built tags that you can use, which are:

    {VERB} = A verb
    {VERB-ED} = A verb ending in 'ed'
    {VERB-ING} = A verb ending in 'ing'
    {VERB-S} = A verb ending in 's'
    {NOUN} = A noun
    {NOUN-PLURAL} = A plural noun
    {ADJECTIVE} = An adjective
    {ADVERB} = An adverb
    {EMOTION} = An emotion
    {NUMBER} = A number
    {PLACE} = The name of a place
    {ROOM} = The name of a room
    {FOOD} = The name of some food
    {MALE} = A man's name
    {FEMALE} = A woman's name
    {OPPOSITESEX} = Name of a member of the opposite sex
    {SAMESEX} = Name of a member of the same sex
    {ANIMAL} = An animal
    {ANIMAL-PLURAL} = An animal (plural)
    {FUNNY} = Something funny
    {BODYPART} = A body part
    {BODYPART-PLURAL} = A body part (plural)
    {CELEBRITY} = The name of a celebrity
    {MADEUP} = Just make up a word


If you wanted to add you own words, then you could either update the class to add your tags to setDefaultTags method, of you could just add tags when you call your script, like this:

PHP:
<?php

    
require 'class.madlibs.php';

    
$ml = new madlibs();
    
$ml->useFS('./stories''.txt');
    
$ml->addTag('FRUIT''The name of a fruit');
    
$ml->addTag('TEDDY-BEAR''A good name for a teddy bear');
    
$ml->displayMadlib();

?>


Then just save your stories with whatever extension you're using (in the above example it's '.txt') in the same location as the rest of them.

Don't forget to delete the exmaple story files - I'm sure you wont want them in there when you create your own!

Hope that helps out!

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