cehlo Posted April 10, 2019 Posted April 10, 2019 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). 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 :).
gmclelland Posted April 10, 2019 Posted April 10, 2019 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
WillyC Posted April 10, 2019 Posted April 10, 2019 looks.ikes u w ant $table->setEncodeEntities(false); 4
gmclelland Posted April 10, 2019 Posted April 10, 2019 WillyC is right. I forgot that I have that in mine as well.
WillyC Posted April 10, 2019 Posted April 10, 2019 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 3
cehlo Posted April 10, 2019 Author Posted April 10, 2019 Thank you all. WillyC hit it. That was my one little mistake ?
horst Posted April 11, 2019 Posted April 11, 2019 Hey @WillyC, nice to read from you again. (Long time no see.) ? 3
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now