Log in

View Full Version : Adding coin image instead of a currency name.q


LucasA33
12-21-2013, 05:56 AM
I'm new to PHP so I am at a loss of what to do here, but I want to add a small 16x16 icon image where it says MONEY:
http://i.imgur.com/KaqfIb4.png

I've tried resources like google but all it ever does is confuse me :P
Maybe one of you guys could help me put this together.

Current code:

/**
* The getMoneyBar method, getter method for property $moneyBar.
* @access public
* @return Paragraph
*/
public function getMoneyBar(){
return $this->moneyBar;
}

/**
* The setMoneyBar method, setter method for property $moneyBar.
* It is set internally upon object instantiation, cannot be accessed in client code.
* @access protected
* @return Void
*/
protected function setMoneyBar(){
$mysidia = Registry::get("mysidia");
$this->moneyBar = new Paragraph;
$this->moneyBar->add(new Comment("Money: {$mysidia->user->money} {$mysidia->settings->cost} | "));

$donate = new Link("donate");
$donate->setText("Donate");
$this->moneyBar->add($donate);
$this->setDivision($this->moneyBar);
}

Hall of Famer
12-21-2013, 06:11 AM
If you wish to add an image to the money bar, use the following code:


$this->moneybar->add(new Image("image.gif"));

LucasA33
12-21-2013, 06:16 AM
Ok, thanks. I probably feel stupid for not figuring that out myself :Q:

IntoRain
12-21-2013, 07:58 AM
By the way, google doesn't help much Mysidia-wise xD

LucasA33
12-21-2013, 09:01 AM
Yeah but PHP is :P

IntoRain
12-21-2013, 11:24 AM
Yes, but Mysidia is a pretty complete framework, which means it has its own ways of doing things. Usually you add a picture with HTML tags not PHP, mysidia has its own way of "adding image" that simplifies this process

LucasA33
12-22-2013, 01:32 PM
If you wish to add an image to the money bar, use the following code:


$this->moneybar->add(new Image("image.gif"));


I'm not exactly sure how to add that with out it erroring out. Mind if you post a completed line with it included? I still want a comment as well.

Hall of Famer
12-22-2013, 08:05 PM
I'm not exactly sure how to add that with out it erroring out. Mind if you post a completed line with it included? I still want a comment as well.

What errors do you get? The images cannot be found? If the image is hosted on your server, just use path like templates/images/myimage.png.

katsunya
01-19-2014, 02:42 PM
What file would we have to edit in order to do this?

Hall of Famer
01-19-2014, 04:00 PM
the file class_sidebar.php in your /classes folder.

katsunya
01-24-2014, 07:19 PM
Alright, thanks much!

Silver_Brick
10-27-2016, 10:38 AM
exactly near what code we need to add or replace the code to add currency icon

Hwona
11-03-2016, 08:20 AM
Go to classes->class_sidebar.php

Add the code above:
$this->moneyBar->add(new Comment("Money: {$mysidia->user->money} {$mysidia->settings->cost} | "));

Silver_Brick
11-03-2016, 08:34 AM
thanks so much :)