insert_block() ruins arguments containing HTML

Game development with Board Game Arena Studio
Post Reply
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

insert_block() ruins arguments containing HTML

Post by pikiou »

I find it great to color player names whenever they are shown. It makes they more readable (as long as they are not dark on a dark background or something...)
But since it adds HTML code to plain text, it's troublesome.

In mygame.view.php, I have this:

Code: Select all

$this->page->insert_block("player_district", Array(
   'DISTRICT_OF' => str_replace('$playerName', $this->game->coloredPlayerName($player), self::_('District of $playerName'))
));
And guess what, $this->game->coloredPlayerName() returns some HTML which $this->page->insert_block() seems to processes through htmlentities() and screw up.

Now, for the question: how can I make $this->page->insert_block() not put some arguments through htmlentities()? Or even better, how can I easily make this work?
Thanks ^^
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: insert_block() ruins arguments containing HTML

Post by sourisdudesert »

Hello,

You can use this:

Code: Select all

$this->page->insert_block("your_blockt", Array(
   'SOME_ARGUMENT' => self::raw( $some_html )
));
http://en.doc.boardgamearena.com/Game_l ... #Variables

Cheers,
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: insert_block() ruins arguments containing HTML

Post by pikiou »

This is magic!
Thanks ^^
Post Reply

Return to “Developers”