Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #11  
Old 11-09-2014, 11:42 AM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 18,407
NobodysHero is on a distinguished road
Default

Holy cow. Yes, please, IntoRain. This is what I've been looking for since I woke up this morning. LOL! And even a little bit before that. If you could give a step by step for this process (Maybe with some pictures to make a lil fool proof?) That would be amazing! Thanks so much!


____________________________

NobodysHero
MystFell.com
Venture Into The Mist
Reply With Quote
  #12  
Old 11-09-2014, 12:10 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,089
parayna is on a distinguished road
Default

Oh, would you? :D Thanks! And yeah, this seems like the way I would like to do it ^_^ I do know a little bit about the ID's and stuff from listening to what people have told me and what I have read, but not really enough to do everything myself (like the coding, etc.) XD

~Parayna
Reply With Quote
  #13  
Old 11-09-2014, 02:44 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,257
IntoRain is on a distinguished road
Default

@NobodysHero
So you own MystFell? Beautiful art! I think I submitted the form put up on VPL, but I'm not sure haha

---------
Alright. This is a very manual version. I didn't do the "active" column version because I'm not sure what you will use this for and that way would be restricting it too much. This way, you can put a linked image in whatever page to make people obtain an adoptable - fun for treasure hunts?

Checking your database for the IDs

Since you will need to get the IDs you want for the adoptable, you will need to go check your database (I haven't checked the admincp to see if they are shown there because mine is currently under changes, sorry).

1) Use phpMyAdmin or similar from your control panel to access your database.
2) Once you are there, choose the database you use for your site (from the left side or by going to "Databases" at the top).
3) Then, choose the table something_adoptables (default is adopts_adoptables)
4) Look at the column id, these will be the numbers you will use. Check the names and images to see if it's the species you want

Image: http://i.imgur.com/ePST02Y.png

Putting the linked image up

Choose which page you want this to appear and link an image to /get/id/ID_NUMBER. This ID_NUMBER should be the same as one of your existing species in the database (see above).

To add it to pages like yoursite.com/adopt, go to inside the view folder and edit the file adoptview.php. Search the index() function and:

PHP Code:
public function index(){    
//you will find something like this in this function:
        
$mysidia Registry::get("mysidia");
        
$document $this->document;        
            
$document->setTitle("News");//I chose a page I have called News
//put this anywhere after the title. Edit the ID to your liking, change the image link, add more images, etc.
            
$document->add(new Comment("<a href='/get/id/1'><img src='http://i.imgur.com/Bjzw7CM.gif'></a>"));
....

You can add more $document->add(new Comment(""));
You can also write HTML code inside the quotation marks " ", so feel free to do things like this:

PHP Code:
$document->add(new Comment("
<b>ADOPT ME:</b>
<br><br>
<a href='/get/id/1'><img src='http://i.imgur.com/Bjzw7CM.gif'></a><br>
<a href='/get/id/7'><img src='another_image.png'></a>
"
)); 
Be careful to use ' ' instead of " " for the links and image links!

Do this: <img src='link.png'>
Not this: <img src="link.png">

The double quotation for the links might interfere with the previous marks and make your page throw errors! Always use the single quotation ones inside Comments("") to avoid mistakes!

Building the GET page!

Alright, clicking the image will take you to your index probably. We have to create the page that will take care of adopting.

Note:
If your link is yoursite.com/get/id/ID_NUMBER then your files need to be get.php and getview.php and both need an index() function and an id() function.
If your link is yoursite.com/capture/get/ID_NUMBER then your files need to be capture.php and captureview.php and both need an index() function and a get() function.
Etc... Just substitute the "get" word and the "id" word used for this explanation

For this example, my link is yoursite.com/get/id/ID_NUMBER
Create a file named get.php with these contents:

PHP Code:
<?php

use Resource\Native\Integer;
use 
Resource\Native\String;

class 
GetController extends AppController{

    private 
$id;
      
    public function 
__construct(){
    
        
parent::__construct("member");
        
$mysidia Registry::get("mysidia");
    
        if(
$mysidia->usergroup->getpermission("canadopt") != "yes"){
            throw new 
NoPermissionException("permission");
        }    
    }
    
    public function 
index(){
           
//don't let people access yoursite.com/get
        
throw new InvalidActionException("global_action");

    }
    
      
//yoursite.com/get/id
    
public function id(){
        
$mysidia Registry::get("mysidia");

        
//get ID_NUMBER
        
$pageURL 'http';
        if (
$_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
        
$pageURL .= "://";
        if (
$_SERVER["SERVER_PORT"] != "80") {
        
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
        
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }
        
        
$parts Explode('/'$pageURL);
        
$id $parts[count($parts) - 1];
        
        if(!
$id) throw new InvalidIDException("global_id");
        
        
//---------- Edit here
        /* In this part, we check if the ID is actually part of the IDs available to adopt! 
        * If you want adoptable 1 and 7 to be available through get/id/number, you gotta add
        * 1 and 7 to the array
        */ 
        
        
$id_array = [1,7];//add your OK numbers here
        
$count count($id_array);
        
$found false;
        
        for(
$i 0$i $count$i++)
        {
            
//if ID is inside the array, then it's OK
            
if($id == $id_array[$i]){
                
$found true;
                break;
            }
        }
        
        
//the ID wasnt found inside the array, throw error
        
if(!$found)
            throw new 
NoPermissionException("This adoptable is not available through this method.");
        
        
//---------- 

        //after checking:
        
$this->access "member";
            
$this->handleAccess();    
            
        
//get adoptable information
        
$adopt = new Adoptable($id);                    
                        
        
$conditions $adopt->getConditions();
        if(!
$conditions->checkConditions()) throw new NoPermissionException("condition");
        
        
$name $adopt->getType();
            
$alts $adopt->getAltStatus();
           
$code $adopt->getCode();
        
$gender $adopt->getGender();
        
        
//insert into database
            
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $name"name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"offsprings" => 0"lastbred" => 0));
        
        
//get its info
        
$aid $mysidia->db->select("owned_adoptables", array("aid"), "code='{$code}' and owner='{$mysidia->user->username}'")->fetchColumn();
        
$this->setField("aid", new Integer($aid));
            
$this->setField("name", new String($name));            
        
$this->setField("eggImage", new String($adopt->getEggImage()));
        
        
        
    }
    
}
?>
Search where it says "Edit here" in the file above, read the instructions and edit the array how you want it.


Create a file named getview.php inside the view folder with these contents:

PHP Code:
<?php

class GetView extends View{
    
    public function 
index(){
    
        
$mysidia Registry::get("mysidia");
        
$document $this->document;        
            
$document->setTitle("Adopt a pet");
            
       }
       
           public function 
id(){
        
$document $this->document;    
        
$document->setTitle("Adopt a pet");        
        
        
$aid $this->getField("aid")->getValue();
        
$name $this->getField("name")->getValue();
        
$eggImage $this->getField("eggImage")->getValue();
        
        
//display information
        
$image = new Image($eggImage);
        
$image->setLineBreak(TRUE);    
            
$document->setTitle("Catching {$id} ");
        
        
$document->add($image);
        
$document->addLangvar("Congratulations!  You just adopted {$name}.  You can now manage {$name} on the ");
        
$document->add(new Link("myadopts""Myadopts Page."));
        
$document->add(new Comment(""));
        
$document->add(new Link("myadopts/manage/{$aid}""Click Here to Manage {$name}"));
        
$document->add(new Comment(""));
        
$document->add(new Link("myadopts/bbcode/{$aid}""Click Here to get BBCodes/HTML Codes for {$name}"));
        
$document->add(new Comment(""));
        
$document->addLangvar("Be sure and");
        
$document->add(new Link("levelup/{$aid}""feed "));
        
$document->addLangvar("{$name} with clicks so that they grow!");
        
    }

    
}
?>
So now visiting yoursite.com/get/id/1 should add an adoptable to your account (if the number 1 is in your id_array)

I might have forgotten something. If you notice an error, please tell me
__________________


asp.net stole my soul.

Last edited by IntoRain; 11-09-2014 at 02:50 PM.
Reply With Quote
  #14  
Old 11-09-2014, 03:12 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,089
parayna is on a distinguished road
Default

Thanks for this! I will have a go (one question, if I wanted to use a custom page for the image, could I do that? So not have them appearing on the adopt.php page... if that makes sense) Also, what adoption restriction would I set (if I had to use the adopt.php page)? Would I make it something like 'promo'? (Because if it is 'always' it appears on there without an image linking it)

Basically, on my site, there is a custom adopt page with a character talking, then a banner beneath it that says, 'Adopt a...' and when you click it, it takes you to a page where you can adopt that species. And I want it where you can click on an image on THAT page and it adds the adoptable to your account.. do I make sense? XD

Thanks!

~Parayna

(For an example, Chicken Smoothie does something very similar to what I would like, if you know it ^_^)
Reply With Quote
  #15  
Old 11-09-2014, 03:24 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,257
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by parayna View Post
Thanks for this! I will have a go (one question, if I wanted to use a custom page for the image, could I do that? So not have them appearing on the adopt.php page... if that makes sense)
Yeah, you can put the link /get/id/ID_NUMBER on any page you want


Quote:
Originally Posted by parayna View Post
Also, what adoption restriction would I set (if I had to use the adopt.php page)? Would I make it something like 'promo'? (Because if it is 'always' it appears on there without an image linking it)
I actually haven't thought about this and I can't test it right now x.x But maybe try with different restrictions? Promo sounds good. If it doesn't work, try removing the line with checkConditions() from get.php


Quote:
Originally Posted by parayna View Post
Basically, on my site, there is a custom adopt page with a character talking, then a banner beneath it that says, 'Adopt a...' and when you click it, it takes you to a page where you can adopt that species. And I want it where you can click on an image on THAT page and it adds the adoptable to your account.. do I make sense? XD

Thanks!

~Parayna

(For an example, Chicken Smoothie does something very similar to what I would like, if you know it ^_^)
I don't know Chicken Smoothie, sorry but yeah, if you add those pages, you just need the link to /get/id/ID_NUMBER on the adoptable page you want and it should work ^^
__________________


asp.net stole my soul.
Reply With Quote
  #16  
Old 11-09-2014, 03:55 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 16,089
parayna is on a distinguished road
Default

Thank you! It worked! :D Now people can adopt them from the page I want!
Reply With Quote
  #17  
Old 11-09-2014, 04:05 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,257
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by parayna View Post
Thank you! It worked! :D Now people can adopt them from the page I want!
I'm glad it worked! ^^ if you find any bugs or something, feel free to warn me!
__________________


asp.net stole my soul.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A small question regarding adoption limits and promo codes..c: Pear Feedback and Suggestions 2 06-25-2014 10:06 PM
Promo Codes SilverDragonTears Questions and Supports 2 06-30-2012 01:22 PM
Promo And Banning Alaric Questions and Supports 5 04-20-2012 08:28 AM
News/kinda forum script help SilverDragonTears Questions and Supports 0 10-22-2011 06:48 PM
1 Promo per person Xius Questions and Supports 4 09-21-2009 05:55 PM


All times are GMT -5. The time now is 11:23 AM.

Currently Active Users: 464 (0 members and 464 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636