• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Anchor links to mainpage

#1
Hello,

I edited the terms and rules phase and uses some anchors in the text. But the link doesn't jump to the anchor, but to the mainpage of the forum. Has someone a solution for that?

Regards,
Markus
 
#3
The terms_rules_text-phrase. I have a table of content first, like

HTML:
<ul>
  <li style="list-style-type:none;"><a href="#kap0">Vorwort</a></li>
</ul>
and in the text i define the anchor:

HTML:
<h3><a name="kap0">Vorwort</a></h3>
<p>
 
R

ragtek

Guest
#5
probably this will work

<ul>
<li style="list-style-type:none;"><a href="{$tosUrl}#kap0">">Vorwort</a></li>
</ul>
 
#6
With an id there is the same result, I tested it before.

The solution of ragtek gives only a new site, that the site can not found.
 
R

ragtek

Guest
#7
OK, i've played a little bit with this and found the problem:)

It's because of xenforos base

e.g. on this site:
<base href="http://xenforo.com/community/" />


so if you have only an link with an anchor tag "href="#foo" it will link to http://xenforo.com/community/#foo"

and that's why it's always redirecting to the index page:)


You could change

<a href="#kap0">Vorwort</a></li>

to
<a href="{$requestPaths.requestUri}#kap0">Vorwort</a></li>
 

Jake Bunce

XenForo moderator
Staff member
#9
{$requestPaths.requestUri} works in the templates but not in the phrases unless you pass in the value:

Admin CP -> Appearance -> Templates -> help_terms

Add the red code:

Code:
<xen:title>{xen:phrase terms_of_service_and_rules}</xen:title>

<div class="baseHtml">

{xen:phrase terms_rules_text, 'requestUri={$requestPaths.requestUri}'}

</div>
Now you can use {requestUri} when you edit the phrase.
 
#10
{$requestPaths.requestUri} works in the templates but not in the phrases unless you pass in the value:

Admin CP -> Appearance -> Templates -> help_terms

Add the red code:

Code:
<xen:title>{xen:phrase terms_of_service_and_rules}</xen:title>
 
<div class="baseHtml">
 
{xen:phrase terms_rules_text, 'requestUri={$requestPaths.requestUri}'}
 
</div>
Now you can use {requestUri} when you edit the phrase.
That works, thanks for your help!