Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
Small changes to the file /inc/common.php
I think it will be useful for many!
Avatar
olexsyn #1
Member since Aug 2017 · 1 post · Location: Kiev, Ukraine
Group memberships: Members
Show profile · Link to this post
Subject: Small changes to the file /inc/common.php
I think it will be useful for many!

The file - ''/inc/common.php'', the line ~ 1108:

    $tpl = str_replace(
        array(
             '@ID@',
             '@NS@',
             '@FILE@',
             '@!FILE@',
             '@!FILE!@',
             '@PAGE@',
             '@!PAGE@',
             '@!!PAGE@',
             '@!PAGE!@',
             '@USER@',
             '@NAME@',
             '@MAIL@',
             '@DATE@',
             '@TITLE@',                           //  <-- ADD THIS
        ),
        array(
             $id,
             getNS($id),
             $file,
             utf8_ucfirst($file),
             utf8_strtoupper($file),
             $page,
             utf8_ucfirst($page),
             utf8_ucwords($page),
             utf8_strtoupper($page),
             $INPUT->server->str('REMOTE_USER'),
             $USERINFO['name'],
             $USERINFO['mail'],
             $conf['dformat'],
             p_get_first_heading(getNS($id)),      //  <-- ADD THIS
        ), $tpl
    );


This will allow to realize the following feature:

Create the template ''/data/pages/perl/__template.txt'' ("perl" - just for example):


====== @TITLE@. @!PAGE@ ======

<file perl>
</file>

          
\\

Back to [[:@NS@|@TITLE@]]


The page ''data/pages/perl.txt'' has a <h1>-title as "Perl Notes" (====== Perl Notes ======).

If we will create new page '':perl/test2'' we will get the name of the parent page in the child page:


====== Perl Notes. Test2 ======

<file perl>
</file>

\\

Back to [[:perl|Perl Notes]]


Thanks!
Avatar
phy25 #2
Member since Aug 2017 · 13 posts
Group memberships: Members
Show profile · Link to this post
Hi, why not add a pull request at https://github.com/splitbrain/dokuwiki/ ?
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-26, 15:28:59 (UTC +01:00)