Jump to content
cehlo

[SOLVED] Showing html markup instead of links

Recommended Posts

Hello, 

i just hit another problem. Maybe is very easy, but I can not find the place where I am having error. 

So I am doing some admin custom page - it shows requests from users for administrator. Administrator checks request and then should hit button approve or delete request. I am done this by creating table, and for each row in template I want to add also link with some data for GET. 

Problem is that table for some reason does not encode/render the link proper way - it only output html markup. (image 1, 2). 

test1.thumb.png.f997a7cd453b5efb9502d2fcf5730b0a.png

Maybe I am missing something important? My relevant part of code below:

<?php


class ProcessRequests extends Process {

	public function init() {
		parent::init(); // required
	}

	
	public function ___execute() {

        $requests = new WireArray();
		$match = $this->pages->find("template=request");
        $requests->import($match);
        $requests->unique();
		$requests->sort("-created");

        $count = count($requests);
        if ($count) {
            $url = $this->config->urls->admin . 'page/edit/?id=';
            $table = $this->modules->get('MarkupAdminDataTable');
            $table->setSortable(true);
            $table->setEncodeEntities(true);

            $table->headerRow(array(
                $this->_('#'),
                $this->_('Názov žiadosti'),
				$this->_('Typ žiadosti'),
				$this->_('Týka sa psa'),
                $this->_('Žiadosť podal'),
				$this->_('Vytvorená'),
				$this->_('Akcia'),
            ));

		foreach ($requests as $key => $u) {

			$mailer = $this->pages->get($u->request_mailer_id);
			$dog_ref = $this->pages->get($u->request_dog_reference->id);

            $table->row(array(
                $count - $key,
                $u->title => $url . $u->id,
				$u->request_type->title,
				$dog_ref->title => $url . $dog_ref->id,
				$mailer->name,
				date('Y.m.d - H:i', $u->created),
				"<a href=''>Schváliť</a>",
                ));
            }

            $out .= $table->render();
        } else {
            $out .= "<p>" . $this->_("Well done, all dogs are edited.") . "</p>";
        }

		return $out;
	}

}

Thanks for any replies :).

Share this post


Link to post
Share on other sites

Change this line from:

"<a href=''>Schváliť</a>",

to something like:

"<a href='{$page->editUrl}&modal=1' class='pw-panel pw-panel-right'>{$page->title}</a>",

In my module that would open the page editor in a right side panel.

You need to escape those characters in PHP.  See https://phppot.com/php/php-escape-sequences/

Hope that helps

Share this post


Link to post
Share on other sites

 wire( 'sanitizer')->entities( $u->title ) => $url . $u->id,
  wire( 'sanitizer')->entities( $u->request_type->title ),
  wire( 'sanitizer' )->entities( $dog_ref->title ) => $url . $dog_ref->id,
 wire( 'sanitizer' )->entities( $mailer->name ),
  ... 
"<a href=''>Schváliť</a>", // u NO.entitties on this.ones

  • Like 3

Share this post


Link to post
Share on other sites

Thank you all. WillyC hit it. That was my one little mistake 🙂 

 

 

Share this post


Link to post
Share on other sites

Hey @WillyC, nice to read from you again. (Long time no see.) 😉

  • Like 3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...