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 Solloby » Mon Dec 08, 2008 2:26 pm

Hey Nick,

Before studying for my exam later today I decided to muck around with the php and give it a try. So I duplicate my adoption page and added all the php etc and uploaded everything.

When I click the egg I want to adopt it gives me this message:

Code: Select all
Fatal error: Call to undefined function: simplexml_load_file() in [URL HERE]/adopttools.php on line 4


I didn't really edit adopttools though. Here are the first 4 lines:
Code: Select all
<?php

//Load the adoptables XML file
$adoptxml=simplexml_load_file("adoptables.xml");


adoptables.xml exists and the syntax all looks ok in it.

What, or at least where, is my problem?
I wouldn't mind upgrading from Javascript to PHP see.
Speaking of which, someone asked me about my Javascript, so I thought I'd release the code and explain it all so people that find your wonderful PHP too complex or daunting can start off with it instead. I figure I might post it here at CS, which forum would be most suitable?

Anyway I must study now,
But ty muchly, I hope you can help me ^.^
~ Solloby
Solloby
I take care of the CS archives and
sometimes submit pet/item designs.

Characters :: Artwork

Help
You can find Help in the main navigation menu.
If your question or problem is not answered there, please use the Help System.
I am not a mod and cannot help you so please don't PM me for site help.
User avatar
Solloby
Archivist
 
Posts: 15451
Joined: Sat Jun 21, 2008 7:27 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Mon Dec 08, 2008 2:29 pm

Your server is running the (old, not supported any more) PHP 4, which doesn't include this function. Some web hosts allow you to switch your PHP version from your control panel, so give that a look.

About posting your script, you could probably post it in the CS Adoptables forum. I'll see if we can link to it from our HTML tutorials page (along with my script.. :))
User avatar
Nick
Admin
 
Posts: 6337
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 Tekkanin » Mon Dec 08, 2008 3:18 pm

Wow, thank you! I've been wanting to make my own adoptables site for a long time now.
User avatar
Tekkanin
 
Posts: 193
Joined: Wed Sep 24, 2008 9:22 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Solloby » Mon Dec 08, 2008 6:42 pm

Oh boo. Actually I don't have a control panel, a CS member was so very kind and gave me my own subdomain at her web server so I just click the 'Put' button in Dreamweaver and fwoosh, FTP magic happens. Ah well, php is more complex. Nice automated growings but I guess we can't have everything huh. I'll mention it to them but it's not a big thing ^.^

Awesome, I'll go make it now. Thanks so much Nick!

Oh and my exam today went well :mrgreen:
Solloby
I take care of the CS archives and
sometimes submit pet/item designs.

Characters :: Artwork

Help
You can find Help in the main navigation menu.
If your question or problem is not answered there, please use the Help System.
I am not a mod and cannot help you so please don't PM me for site help.
User avatar
Solloby
Archivist
 
Posts: 15451
Joined: Sat Jun 21, 2008 7:27 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby blacksquirrel950 » Tue Dec 09, 2008 1:41 pm

I'm going to try that for my *still under construction* website once I have the time! :D
Thanks a lot, Nick!
Hem hem. I'm back. ^^
ImageImage
Please click my dragons!

Image
(Thanks, Mellina! :D)
User avatar
blacksquirrel950
 
Posts: 85
Joined: Thu Aug 28, 2008 7:35 am
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby qhost » Tue Dec 09, 2008 8:34 pm

kk...so I've read through everything and I understand it and all, except one thing...

With the 'chance' for each variation, there was only two different ones listed, so...what if I wanted to have more than that? If I wanted to have one common, one uncommon, and one rare...how would I go about doing that? :?

Oh, and also...I need a free webhost/server to make a site. One that allows the php I'll be using ^.^
    -
    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    I have real bad anxiety so I take a while to respond
    to msgs sometimes, sorry!
    -
User avatar
qhost
 
Posts: 4107
Joined: Wed Oct 01, 2008 6:36 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Wed Dec 10, 2008 1:09 pm

000webhost.com is free and supports all the features you need.. :).

You'll notice that each variation was enclosed in <variation></variation> tags? Just add another variation tag in that same area, just like the other two variations. (be sure to increase its ID by one when you add it)
User avatar
Nick
Admin
 
Posts: 6337
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 qhost » Wed Dec 10, 2008 6:44 pm

thenickdude wrote:000webhost.com is free and supports all the features you need.. :).

You'll notice that each variation was enclosed in <variation></variation> tags? Just add another variation tag in that same area, just like the other two variations. (be sure to increase its ID by one when you add it)


Hmm...I'll try out that website, even if it does look kind of scary XD

I still don't quite understand the chance part...it mentioned that the second was 10 times more likely to happen, but if there was more that two which would be 10 times what, or more rare?

How about this:

pet one's chance is 1.0 (the rare one)
pet two's chane is 5.0 (the common one)
pet three's chance is 3.0 (the uncommon one)


Would that work? v.v
    -
    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    I have real bad anxiety so I take a while to respond
    to msgs sometimes, sorry!
    -
User avatar
qhost
 
Posts: 4107
Joined: Wed Oct 01, 2008 6:36 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Re: Make your own PHP adoptables system

Postby Nick » Wed Dec 10, 2008 7:58 pm

Yes, of course, so you can do something like this:

Code: Select all
<adoptables>

<adoptable id="1">
   <variation id="1" chance="1.0">
      <age image="dogbaby.png" />
      <age days="5" image="dogpuppyrare.png" />   
      <age days="10" image="dogadultrare.png" />
   </variation>
   <variation id="2" chance="5.0">
      <age image="dogbaby.png" />
      <age days="3" image="dogpuppy.png" />   
      <age days="8" image="dogadult.png" />
   </variation>
   <variation id="3" chance="3.0">
      <age image="otherbaby.png" />
      <age days="3" image="otherpuppy.png" />   
      <age days="8" image="otheradult.png" />
   </variation>
</adoptable>

</adoptables>


The second one is 5 times more likely than the first (because the chance is 5 times larger). The last one is three times more likely than the first (because the chance is 3 times larger).
User avatar
Nick
Admin
 
Posts: 6337
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 qhost » Wed Dec 10, 2008 8:03 pm

Okay. Thank you :) Makes more sense now :lol:
    -
    she/they | adult | australia | artist | writer
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    My name is Boo & I am perpetually tired.
    I have real bad anxiety so I take a while to respond
    to msgs sometimes, sorry!
    -
User avatar
qhost
 
Posts: 4107
Joined: Wed Oct 01, 2008 6:36 pm
My pets
My items
My wishlist
My gallery
My scenes
My dressups
Trade with me

Who is online

Users browsing this forum: No registered users and 4 guests