Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Mys v1.3.3 Background Mod (http://www.mysidiaadoptables.com/forum/showthread.php?t=4816)

Hwona 04-15-2015 09:58 AM

Background Mod
 
This is a simple background mod for displaying backgrounds on adoptable pages. Please save a backup of your entire site before using this mod as I can't guarantee it will work - my own site uses this system but it's heavily moddified and the coding is likely quite different for these pages. I apologize if anything breaks because of this or if the instructions are too confusing.

__________________________________________________ _____

These are the edits for the files:
In class_ownedadoptable.php, add below the list of "protected stuff":
PHP Code:

protected $background

below all the public functions, add:
PHP Code:

public function getAdoptBackground(){
        return 
$this->background;
    } 

In levelup.php:
inside of the click function, below
PHP Code:

 $mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();        
        
$date = new DateTime;
        
$ip secure($_SERVER['REMOTE_ADDR']); 

add:
PHP Code:

$background $this->adopt->getAdoptBackground(); 

below:
PHP Code:

 $mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();        
        
$date = new DateTime;
        
$ip secure($_SERVER['REMOTE_ADDR']);
$background $this->adopt->getAdoptBackground(); 

add:
PHP Code:

$message "<div><div style='text-align:center;background-image:url({$mysidia->path->getAbsolute()}picuploads/backgrounds/{$background}.png);'><br><img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$this->adopt->getAdoptID()}'></div>"

In functions_items.php:
below all the functions, add:
PHP Code:

 function items_background($item$adopt){
  
$mysidia Registry::get("mysidia");
  
// Update the lastbred info.
  
$background $item->backgroundimage;
  
$mysidia->db->update("owned_adoptables", array("background" => $background), "aid ='{$adopt->aid}' and owner='{$item->owner}'");    
  
$note "Your adoptable now has a new background!<br>";
  
//Update item quantity...
  
$delitem $item->remove();   
  return 
$note;


In the picuploads folder, make a new folder called "backgrounds" and fill it with all your different background image files. They must all be png files!!! Give each file an alpha numeric name with NO SPACES!
__________________________________________________ ______

Now, let's edit the database

In the items_functions table, create a new row - put "Background" in the function column and "Adoptable" in the intent column. Put a description in the description column.

Now, in the items table, add a column of varchar(200) latin_swedish_ci with a default value of NULL called "backgroundimage"

__________________________________________________ ______

Now, let's make your first background

create a new row in the items table as a new item. Name your background, set the price, stock, etc.
Except. in the function column, put "Background" and in the "backgroundimage" column, put the name of the file you want to serve as the background (just the alphanumeric name). Do not include the path to the folder or the .png!

__________________________________________________ ______

That should be it!

Kyttias 04-15-2015 10:41 AM

Nice use of $mysidia->path->getAbsolute()!

Missy Master 04-15-2015 12:11 PM

oh I woke up to this and it made my whole day :)

Thank you and Kyttias both for all your help trying to get this going, yay, a MOD for it!! *dances*

Hwona 04-15-2015 04:46 PM

Does anyone know if this works? I can't test on my testing site because nothing works on it right now. As for my main site, I can't tell from the code.

Missy Master 04-15-2015 05:03 PM

Followed it all to the letter and for 1.3.4 everything loads fine, but when I go to use the BG I am getting:

An error has occurred.

The item function is invalid


However! I think its because its 1.3.4!

Going to try this on 1.3.3 now! I am sure its going to work there, no idea why it isn't working for 1.3.4, I looked everything over and didn't see what could possibly be wrong --- however not everything for 3 will work for 4.

If anyone else wants to take a look and see why it might not work for 1.3.4?

This is a REALLY good and important Mod, be great to have for the new script!

Hwona 04-15-2015 05:10 PM

Quote:

Originally Posted by Annatar (Post 32299)
Followed it all to the letter and for 1.3.4 everything loads fine, but when I go to use the BG I am getting:

An error has occurred.

The item function is invalid


However! I think its because its 1.3.4!

Going to try this on 1.3.3 now! I am sure its going to work there, no idea why it isn't working for 1.3.4, I looked everything over and didn't see what could possibly be wrong --- however not everything for 3 will work for 4.

If anyone else wants to take a look and see why it might not work for 1.3.4?

This is a REALLY good and important Mod, be great to have for the new script!

I remember trying to help Kyttias implement the stat system on 1.3.4... that script displays everything using 2 files I think... I never was able to figure it out. XD

Missy Master 04-15-2015 05:34 PM

I was able to implement adding in items that are shown under the Pet image a long time ago in 1.3.4, and I compared that item function to this one, and I swear I don't see whats missing or wrong! xD

There's likely just ONE thing I am missing somewhere.

Now I'm setting up a 1.3.3 site to test this, and getting all the Strict Standards and headers already sent stuff

Code:

Strict Standards: Declaration of File::getBasename() should be compatible with SplFileInfo::getBasename($suffix = NULL) in /home/petsim/public_html/Etheria/classes/class_file.php on line 19

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/petsim/public_html/Etheria/classes/class_file.php:19) in /home/petsim/public_html/Etheria/classes/class_session.php on line 13

Warning: Cannot modify header information - headers already sent by (output started at /home/petsim/public_html/Etheria/classes/class_file.php:19) in /home/petsim/public_html/Etheria/classes/abstract/abstract_usercreator.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/petsim/public_html/Etheria/classes/class_file.php:19) in /home/petsim/public_html/Etheria/classes/abstract/abstract_usercreator.php on line 25

Warning: Cannot modify header information - headers already sent by (output started at /home/petsim/public_html/Etheria/classes/class_file.php:19) in /home/petsim/public_html/Etheria/classes/abstract/abstract_usercreator.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/petsim/public_html/Etheria/classes/class_file.php:19) in /home/petsim/public_html/Etheria/classes/abstract/abstract_usercreator.php on line 25


Plus it wont let me stay logged in lol!! So I will test this on 1.3 but its gonna take a bit!

Gotta work this out cos there are a lot of mods for 1.3.3 I really want to use, so .. I just need to get this going.

Missy Master 04-15-2015 05:53 PM

Okay I had forgotten for 1.3.4 we go to class_privateitem and add:

Code:


case "Background":
$message = items_background($this, $owned_adoptable);
break;


SO!

Action Completed!
Your Pet now has a new background!

I was able to add it and it gave me a success, but it isn't showing up yet for this pet --- so gonna see what else I need to do!

This is for 1.3.4 !

Missy Master 04-15-2015 06:45 PM

Okay this might help someone sharper than me --

this is 1.3.4, it says the item is applied and congrats new BG etc, and the amount IS going down in my stock!

But no BG shows up on the profile in my adopts, and not in levelup either, until you try to level a SECOND time --- and you get this -- this is the top third of the background image repeated three times!



http://pet-sim.com/Canidae/Error.png

Hwona 04-16-2015 07:51 AM

I only have part of a background mod... the BG only shows up on the click page... for now. The problem is the adoptable images for signatures. In order to have backgrounds in those pictures, you need a system that saves a new image - each adopt needs to have its own individual image. I know this is possible ... I just don't know how to code this. Also, there may be a problem with this for sites with tons of pets. That's a lot of images to have to store.


All times are GMT -5. The time now is 12:57 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.