Jump to content
MakeWebGames

Add html to temate without tpl file?


Sim

Recommended Posts

So with my item System I want different item types to show different pages based on the item type, but the HTML is going to be from an outside class and not the TPL. So I'm having an issue with adding html to the template:

$this->html = $type->getHTML();

Screenshot_20200607-142148.thumb.png.d306e89a662abe3bb6739359b86388ed.png

 

$this->html .= $type->getHTML(); adds the html twice.

Screenshot_20200607-141911.thumb.png.648ba452286f5eb73e279cbefccfae0b.png

TPL

public $placeholder = "{myHTML}";

PHP:

$this->html .= $this->page->buildElement('placeholder', array(
        "myHTML" => $type->getHTML()
      ));    

 

SHOWS MY HTML CODE. DONT RENDER IT

Screenshot_20200607-142512.thumb.png.bb43aa841681782dae75fc83da6ba7a9.png

 

 

TPL:

public $placeholder = " ";

HTML:

$this->html = $type->getHTML();
  $this->html .= $this->page->buildElement('placeholder'); 

RESULT: (UGLY PHP CODE) But does what Its supposed to.

Screenshot_20200607-142752.thumb.png.bda532e4e5bfc1b2bebd20cc59fd0911.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...