Internal Links using PageID
Hi Admin,
Sometimes, I reorganized wiki pages (moving to another sub-page, rename wiki) and it will break the links from another pages.
Can we use wiki PageId to create links because PageId never be changed.
Thanks and Regards,
Files
| plink_action.zip | plink action sample | 1.1 KiB | 10/21/2022 09:33 |
Comments
Log in or create an account to post a comment.
Re: Internal Links using PageID
<?php // {{link pageid=}} if (!defined('IN_WACKO')) { exit; } if (!isset($pageid)) $pageid = ''; if (!isset($inline)) $inline = '0'; $pages = $this->db->load_all( "SELECT tag, title " . "FROM " . $this->db->table_prefix . "page " . "WHERE page_id IN ( " . $pageid . ")" . "ORDER BY title"); if ($inline == '0') { echo '<style type="text/css" scoped>ul + br {display: none;} ul,ol {margin-top: 10px;margin-bottom: 10px;}</style>'; echo '<ul>'; foreach ($pages as $_page) { echo '<li>' . $this->link('/' . $_page['tag'], '', $_page['title']) . '</li>'; } echo '</ul>'; } else { echo $this->link('/' . $pages[0]['tag'], '', $pages[0]['title']); }and then call it in wikipage
{{link pageid=313}}Re: Internal Links using PageID
action/plink.php
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.
Re: Internal Links using PageID
I got error
Re: Internal Links using PageID
I tested it on my local XAMPP, and copied it. Main is declared, you may compare it with a similar template - right now I can't spot an error.
Re: Internal Links using PageID
I am using Wackowiki version: 6.0.25
Re: Internal Links using PageID
file:plink_action.zip
Please try the sample files in the zip file. The problem with copy code around is, that the template requirers the correct line feed to work.
Re: Internal Links using PageID
I have uploaded the files. there's no error but the page didn't show anything.
Re: Internal Links using PageID
truethe query gets cached. I have a 6.0 testing instance, but didn't used it - what could go wrong.An empty result indicates, that it throw the return, so it has no results. You can add there also a message.
Re: Internal Links using PageID
I changed this line
if ($pages = $this->db->load_all( "SELECT tag, title " . // "FROM " . $this->prefix . "page " . // <<-------change this line "WHERE page_id IN (" . $this->ids_string($_page_ids) . ") " . "ORDER BY title", true) )to
Thanks WikiAdmin..
Re: Internal Links using PageID
If you don't do this in templates, the templating engine will throw an error:
templatest: no main template found in action_or_handler/template/path.tpl