Thread: Mys 1.3.3 Background Mod
View Single Post
  #1  
Old 04-15-2015, 09:58 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,995
Hwona is on a distinguished road
Default 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!
__________________

Last edited by Hwona; 04-15-2015 at 10:21 AM.
Reply With Quote