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.4 Abron's Background Mod (http://www.mysidiaadoptables.com/forum/showthread.php?t=5405)

Abronsyth 05-03-2017 03:00 PM

Okie dokie, so you'll need to put it in the manage function. (Assuming you want it to appear while a user is managing an individual pet).
You can do it like this:

Under the manage function you'll see this:
PHP Code:

        $mysidia Registry::get("mysidia");
        
$aid $this->getField("aid")->getValue();
        
$name $this->getField("name")->getValue();
        
$image $this->getField("image");
        
        
$document $this->document;        
        
$document->setTitle("Managing {$name}");
        
$document->add($image);
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br>")); 

Now remove the $document->add($image);. Go to the new Comment below that and replace the text within the " " with this:
PHP Code:

<div style='background:{$adopt->background} no-repeat;vertical-align:bottom;text-align:center;'><img src='{$adopt->getImage()}'/></div><br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br

I think that should work, though I haven't tested it because my manage function is heavily modified, so I had to find the original and edit it.

darrinm3 05-04-2017 08:17 AM

Sorry to keep bothering you, but it still doesn't work. It's givin me a blank page (syntax error on "<img src='{$adopt->getImage()}'/>" and when I get rid of it, the background still doesn't show. I've tried all sorts of things but for some reason can't get it. I even tried echoing the {$adopt->background} inside the style to see if that helped but still nothing.

kristhasirah 05-04-2017 09:01 AM

to call the background you must use the same name given in the owned_adoptables database, so if you used the same name posted here: adoptbackground then the correct way to call it it would be: {$adopt->adoptbackground} and the way to call the adopt image is the one you posted: <img src='{$adopt->getImage()}'/> dont know why is giving you a syntax error...=\

darrinm3 05-04-2017 09:20 AM

That was a typo in my comment, oops! Here is the code I use which gives me a 500 error:

public function manage(){
$mysidia = Registry::get("mysidia");
$aid = $this->getField("aid")->getValue();
$name = $this->getField("name")->getValue();
$image = $this->getField("image");

$document = $this->document;
$document->setTitle("Managing {$name}");
$document->add(new Comment("<div style='background:{$adopt->adoptbackground} no-repeat;vertical-align:bottom;text-align:center;width:100px;height:400px'><img src='{$adopt->getImage()}'/></div><br><br>This page allows you to manage {$name}. Click on an option below to change settings.<br> "));


Here is what happens with the same code except I removed the "img src" tag" (I gave it a height and width to show the div was being created and modified):
http://imgur.com/a/obD4g

Thanks for the help guys.

Abronsyth 05-04-2017 10:01 AM

Alright, so it's failing to call the background URL. What should the URL appear as for that adoptable?

Okay, so this is what I have for my site:
PHP Code:

<td style='background-image:url({$adopt->background});background-repeat: no-repeat;background-position:center;border-top:1px #000 solid;border-bottom:1px #000 solid;vertical-align:bottom;height:155px;'><img src='{$adopt->getImage()}'></td

Try replacing style='background:{$adopt->adoptbackground} no-repeat;vertical-align:bottom;text-align:center;width:100px;height:400px' with this:
PHP Code:

style='background-image:url({$adopt->background});background-repeat: no-repeat;background-position:center;vertical-align:bottom;height:400px;width:100px;' 


NobodysHero 03-30-2018 03:46 PM

Heya! I'd love to get this working, but the background image isn't showing up on the pet. Halp?

My code isn't throwing any errors, so not really sure where to go from here. I've tried it in a few different places, but every time nothing changes.

This is the line of code Dinocaid helped me put together, but it's not working either:

PHP Code:

$document->add(new Comment("<div style='background-image:url('{$adopt->adoptbackground}');background-repeat: no-repeat;background-position:center;'><img src='{$adopt->getImage()}'></img></div>);"

I've already uploaded an image and made it a background item, then used it on my pet. I've removed the code from all the pages so my users can still see their pets in the meantime.

Thanks for any help!

draugluin 08-17-2018 04:34 AM

@ Abronsyth

cool. Thank you very much for for sharings this :)

@ Nobody

Have you try it with

PHP Code:

... $adopt->getadoptbackground ... 

?

this works for me :wutno:

Nairi 10-03-2018 11:50 AM

Hi (sorry for my bad english, i'm from germany :D ),

i tried to bring the background to my game, but i'ts dont show =/ and when i try to show the pet-picture, i became an error:

Code:

Fatal error: Call to a member function getImage() on null in /users/equino/www/view/myadoptsview.php on line 135
That's the Line:
PHP Code:

        $document->add(new Comment(" <div style='background-image:url:{$adopt->adoptbackground} no-repeat;vertical-align:bottom;text-align:center;width:400px;height:283px'><img src='{$adopt->getImage()}'></div><br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br> 

can anyone help me? :)
btw i hope you understand me :coloness:

draugluin 10-04-2018 02:58 AM

Hey Nairi ... endlich mal jemand aus der Heimat :happyc:

hast du unter "Public function manage" stehen

PHP Code:

$image $this->getField("image");
$adopt = new OwnedAdoptable($aid); 

?

und versuch es mal mit getadoptbackground

PHP Code:

..... background-image:url:{$adopt->getadoptbackground


Nairi 10-04-2018 05:08 AM

Hey :)

Na, das ist ja klasse.

Also das Bild vom Haustier wird nun angezeigt, danke :)
Der Hintergrund aber leider noch immer nicht. Sehr mysteriös


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

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