Make your own PHP adoptables system

Need help with the site/forum/pets? Ask questions and get help from other members here.

Re: Make your own PHP adoptables system

Postby Turquoise » Sat Aug 28, 2010 2:56 pm

Nick wrote:You must be viewing a pet that was already adopted. Adopt a new one. All the species work for me now, you just need to un-comment the header('Content-Type... line and the image should appear too.


Wait, where is that again? In simple.php, I added header("Content-Type: image/png"); again, but the pet image still isn't showing when I adopt a new pet. Did I have to take it out anywhere else?
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Aug 28, 2010 3:02 pm

The image files are starting off with a whole lot of space characters which is making them invalid. Make sure that you have no spaces or new lines before the <?php or after the ?> of adopttools.php, simple.php, or key.php.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Sat Aug 28, 2010 3:03 pm

Nick wrote:The image files are starting off with a whole lot of space characters which is making them invalid. Make sure that you have no spaces or new lines before the <?php or after the ?> of adopttools.php, simple.php, or key.php.


I did put a lot of spaces, how do I know exactly where to take away spaces/extra lines/ect.
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Aug 28, 2010 3:08 pm

Nick wrote:Make sure that you have no spaces or new lines before the <?php or after the ?> of adopttools.php, simple.php, or key.php.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Sat Aug 28, 2010 3:16 pm

I'm sorry, I misread that. ^^

Oh my gosh, it works now! Thank You SO much! (And sorry for being kind of... slow with understanding everything.)

Really though, I appreciate all of the help that you have given me. (A lot!!!)

EDIT: Also, what about the old pets that were adopted before now? They still show as the word "image". If it can't be helped, then I can live with that, I am just wondering if there is anything I can do about that?

EDIT: Also, the pets should be grown already. Do I have to change the pet growth dates to the seconds now? I can go in and do that easily, but I was just wondering if I can still set certain dates, or if I have to use second for everything now?

Thanks.
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Aug 28, 2010 3:21 pm

Do you mean pets adopted before you introduced the database system?
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Sat Aug 28, 2010 3:22 pm

Nick wrote:Do you mean pets adopted before you introduced the database system?


Right.
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Aug 28, 2010 3:28 pm

The easiest way would be to put your new system in a new folder from your old one. Then you can use your old code for the old system and the new code for the new system :).

Yes, the times would need to be in seconds with your code now. You could change your age check to allow both "age" and "date" fields. For example instead of your code:

Code: Select all
if (!isset($age['date']) || time() - $row[1] > $age['date']) {

We have something like this for Chicken Smoothie:

Code: Select all
if (!isset($age['date']) || isset($age['age']) && (time() - $row[1])/86400 >= $age['age'] || isset($age['date']) && time() > strtotime($age['date'])) {

That lets you either use dates or ages in days in your XML file. So you could:

Code: Select all
<age image="dogbaby.png" />
<age date="2008-11-20" image="dogpuppy.png" />   
<age date="2008-11-25" image="dogadult.png" />

Or:

Code: Select all
<age image="dogbaby.png" />
<age age="4" image="dogpuppy.png" />   
<age age="6" image="dogadult.png" />
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Turquoise » Sat Aug 28, 2010 3:33 pm

Thanks!

One more question,
If I make a new folder for the "new" coding, what would I have to change in the coding I have now, to direct to the new folder? (I'm bad at explaining obviously. xD)
Last edited by Turquoise on Sat Aug 28, 2010 3:38 pm, edited 2 times in total.
Image
User avatar
Turquoise
 
Posts: 2131
Joined: Sun Sep 21, 2008 9:12 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Sat Aug 28, 2010 3:35 pm

Probably nothing, just copy those files to a new folder and change the links in your site to point to the new adopt.php.
User avatar
Nick
Admin
 
Posts: 6349
Joined: Thu Jul 03, 2008 2:40 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Who is online

Users browsing this forum: Antipathy and 1 guest