Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide start pages #3

Open
Juergen-aus-Zuendorf opened this issue Feb 24, 2015 · 1 comment
Open

hide start pages #3

Juergen-aus-Zuendorf opened this issue Feb 24, 2015 · 1 comment

Comments

@Juergen-aus-Zuendorf
Copy link

It would be very good if start pages were excluded from the top10

My first attempt was to get a workaround by adding a request to the add-function in the file syntac.php:

     public function render($mode, Doku_Renderer $renderer, $data) {
     ...
         foreach($list as $item) {
             if (auth_aclcheck($item['page'],'',null) < AUTH_READ) continue;
             /** Modifikation, um die Startseiten auszublenden: **/
             if (strpos($item['page'],'start') !== false) continue;
             if (!page_exists($item['page'])) continue;
     ...
     }

For I´m no php programmer, I don`t know if this syntax is really correct. And further-on it would be much better to set this behaviour by a new parameter in the {{top|...}} command.

Regards Juergen

@shallimus
Copy link

shallimus commented Mar 21, 2017

Although this issue is two years old, I've been looking at this lately.

The problem with using strpos in that way is that a page :articles:postart or :recipe:mosstartlets would also be excluded. Something like this might be better:

if(preg_match('/:start$/', $item['page'])) continue;

That will only match pages ending in :start

It's still not ideal, though, because:

  • the index page name can be customized in DokuWiki config, so somewhere there's a variable which controls what that is, but I haven't yet looked for that
  • the wiki root page will still show up, since it will be presented as "start" only, so a second condition or a smarter regexp is needed
  • I'm not a PHP expert, nor am I well-versed in DokuWiki plugin structure - I'm just hacking about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants