Not logged in. · Lost password · Register
Forum: General Discussion Syntax and Usage RSS
Internal links syntax
How to do it
Page:  1  2  next 
djiles #1
Member since Jun 2006 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: Internal links syntax
I'm trying to create some internal links between pages but instead of going to the top of the "linked-to" page I want to go to a specific spot on the page, a spot that might be a few screens down the "linked-to" page. According to the wiki syntax page I am told I can do it with:

[[syntax#internal|this section]] which would link me to "This section" on another page.

What does the phrase "syntax#internal" mean?

If I'm on Page A and want to link to Section 12 of Page B what would be an example of "syntax#internal"?

Thanks for the help.

Darrel
Avatar
koko (Moderator) #2
Member since May 2006 · 161 posts · Location: Zonhoven Belgium
Group memberships: Global Moderators, Members
Show profile · Link to this post
hi,

[[namespace1:namespace2:namespace3:Pagename#sectiontitle|The name you would like the link to have]]

[[namespace:page_B#section 12|Section 12]]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Avatar
BlackFog #3
Member since May 2006 · 95 posts
Group memberships: Members
Show profile · Link to this post
Koko, is an underscore "_" not needed anymore?
[[namespace:page_B#section_12|Section 12]]
I have good results with it. ;)


BlackFog
Avatar
koko (Moderator) #4
Member since May 2006 · 161 posts · Location: Zonhoven Belgium
Group memberships: Global Moderators, Members
Show profile · Link to this post
hi,

I never use section-links, so I have no idea whether you have put an underscore in the section title :-D
I'm glad you've got what you wanted ;-)
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Avatar
andi (Administrator) #5
Member since May 2006 · 1233 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #3
Quote by BlackFog:
Koko, is an underscore "_" not needed anymore?
[[namespace:page_B#section_12|Section 12]]

In fact it is not needed. In your special case above the following would result in exactly the same link with much less to write:

[[namespace:page_B#Section 12]]

DokuWiki automatically uses the Section name as link title. For the link itself the anchor is cleaned automatically, too ("Section 12" -> "section_12").
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
gezeke #6
Member since Jun 2006 · 1 post
Group memberships: Members
Show profile · Link to this post
Hi there--

    I just stumbled across this discussion and it intrigues me greatly as creating internal links to a specific section of another page has been baffling me.  I've got the exact syntax recommended below, and the links work perfectly... sometimes.  Sometimes the link just redirects me to the top of the page instead of to a specific section.  Is there anything I'm missing?
Avatar
BlackFog #7
Member since May 2006 · 95 posts
Group memberships: Members
Show profile · Link to this post
Maybe if the page is not long enough and can't be scrolled any further? Otherwise I have no idea why this could happen...


BlackFog
epp #8
Member since Aug 2006 · 8 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #5
I have a problem that I cannot get this kind of links to work if the link starts with a number or is not english. I mean

[[namespace:page#32nd]]

will not jump to the 32nd section. It will go to the right page. The same happens if I use greek language for the text.

Is this a dokuwiki issue or a browser issue? I use firefox.
epp #9
Member since Aug 2006 · 8 posts
Group memberships: Members
Show profile · Link to this post
I see that it is a Dokuwiki issue. I mean the source code generated is:

<h1><a name="nd" id="nd">32nd</a></h1>

I also tested with a plan html file and there doesn't seem to be a restriction on what name one can give. I don't know about XHTML, but I don't see why it should be a problem.

Is this then a bug that I should submit a report on?
Avatar
koko (Moderator) #10
Member since May 2006 · 161 posts · Location: Zonhoven Belgium
Group memberships: Global Moderators, Members
Show profile · Link to this post
hi,

Bugs has to be submitted on: http://bugs.splitbrain.org/
Thanks for revealing the issue :-D
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
epp #11
Member since Aug 2006 · 8 posts
Group memberships: Members
Show profile · Link to this post
I found the problem. I'll report it. A call to headerToLink is missing in the internallink function.
epp #12
Member since Aug 2006 · 8 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
There is a bug in dokuwiki that most likely is the cause of this. A solution has been filed so I guess it should be fixed soon.
Avatar
koko (Moderator) #13
Member since May 2006 · 161 posts · Location: Zonhoven Belgium
Group memberships: Global Moderators, Members
Show profile · Link to this post
Hhmm, maybe it is already fixed in the dev-version. Do you use this version? If not, can you describe how i can see whether it is already fixed or not?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
epp #14
Member since Aug 2006 · 8 posts
Group memberships: Members
Show profile · Link to this post
I use the debian version, not sure it is the dev or not. Anyway, check the file: inc/parser/xhtml.php
In the function: function internallink($id, $name = NULL, $search=NULL,$returnonly=false)

A bit down in this function it says (if not fixed):

        //keep hash
        if($hash) $link['url'].='#'.$hash;

it should, IMH :rolleyes: be:

        //keep hash
        if($hash) {
            $hash  = $this->_headerToLink($hash);
            $link['url'].='#'.$hash;
        }

This makes the links work.  :-)
Avatar
koko (Moderator) #15
Member since May 2006 · 161 posts · Location: Zonhoven Belgium
Group memberships: Global Moderators, Members
Show profile · Link to this post
hi,

I tried it in my wiki (i use the dev), but it hasn't been fixed yet... and if I try your fix, I can't get it working either
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please note the verification code from the picture into the text field next to it.
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 1.6.4, © 2003-7 by Yves Goergen
Current time: 2009-07-04, 16:27:47 (UTC +02:00)
WikiForumIRCBugsDarcsXRefTranslate