[TYPO3] Relative links in template broken

Christopher Torgalson bedlamhotel at gmail.com
Sun Jan 28 01:36:14 CET 2007


Hi,

On 1/27/07, Felix Natter <fnatter at gmx.net> wrote:
> Felix Natter <felix.natter at smail.inf.fh-brs.de> writes:
>
> > "Markus Lange" <markus.lange at bgm-gmbh.de> writes:
> >
> >> > Hi!
> >> >
> >> > felix wrote:
> >> > > I am using a relative link <a href="#top"><img src="up.gif"
> >> > > border="0"/></a>
> >> > > in my HTML template. Unfortunately this is prefixed with the
> >> > > directory
> >> > > name "fileadmin/templates/std" when the template is used:
> >> > > <a href="fileadmin/templates/std/#top"...
> >> > > How can I prevent this from happening? I tried to search on the web
> >> > > but couldn't find anything. I am using templavoila if that matters.
> >>
> >>
> >> Check doc of automaketemplate serach for relativepathprefix.img
> >
> > Couldn't find anything like that in automaketemplate-doc (neither
> > online nor .sxw).
> >
> >> Or simply write   ../../#top
> >
> > This does not work with IE/Firefox: they would generate this link:
> > /fileadmin/#top
> > which is not resolved as "#top".
>
> Meanwhile I also tried "../../../#top" but this will always load
> index.php#top (start page).
>
> Is there any way I could fix this? Any hint would be appreciated.
>
> thanks in advance!


Simple solution: use a typolink in your template:

lib.topLink = IMAGE
lib.topLink {
  file = foo/bar/top.gif
  altText = Top link graphic
  titleText = Top of page...
  stdWrap.typolink {
    parameter.data = page:uid
    section = top
  }
}

For any given page, this should output something like this:

<a href="/link/to/current/page/#top"><img src="foo/bar/top.gif"
alt="Top link graphic" title="Top of page..." width="100" height="50"
/>

...which should work.

-- 
Christopher Torgalson


More information about the TYPO3-english mailing list