This is a comment on Internal Links using PageID, posted by WikiAdmin at 20.10.2022 08:19
View source for Re: Internal Links using PageID
Improved action with template: action/plink.php %%(php) <?php if (!defined('IN_WACKO')) { exit; } // TODO: // (internal) link: title, tag // (external) hashid: page link, version link // {{plink page_ids="1,2,3"}} if (!isset($page_ids)) return; if (!isset($inline)) $inline = 0; $_page_ids = explode(',', $page_ids); if ($pages = $this->db->load_all( "SELECT tag, title " . "FROM " . $this->prefix . "page " . "WHERE page_id IN (" . $this->ids_string($_page_ids) . ") " . "ORDER BY title", true) ) { $tpl->enter($inline ? 'i_' : 'u_'); $i = 0; foreach ($pages as $_page) { $tpl->l_link = $this->link('/' . $_page['tag'], '', $_page['title']); if ($inline && $i++ > 0) { $tpl->l_delim = ', '; } } $tpl->leave(); // u_ / i_ } %% action/template/plink.tpl %% [ === main === ] [ ' message ' ] [= u _ = [ ' // move to CSS file and asign class ' ] <style scoped> ul + br {display: none;} ul, ol {margin-top: 10px; margin-bottom: 10px;} </style> <ul> [= l _ = <li>[ ' link ' ]</li> =] </ul> =] [= i _ = [= l _ = [ ' delim ' ][ ' link ' ] =] =] %% To the topic itself more later, I just improved your action. I renamed the action to plink to distinguage it from similar actions/functions.