0

in a TYPO3-Template, I am inserting images using the following code:

page.10.marks{
  GRAFIK-LINKS = IMAGE
  GRAFIK-LINKS.file = fileadmin/images/header-a.png
}  

Now, this runs fine as long as I do not use speaking URLs, but when enabling extensions such as RealURL or CoolURI, the images are no longer shown. Problem is that the generated HTML refers to these images using relative paths:

<img xmlns="http://www.w3.org/1999/xhtml" width="520" height="180" border="0" alt="" src="fileadmin/images/header-a.png" />  

which is then translated to http://example.com/speaking-URL/in-deep-path/fileadmin/images/header-a.png and not found there :(

How can I get TYPO to use absolute references here?

2 Answers 2

5

This solved my problem:

config.absRefPrefix = /
0

Unless you really need absolute Links, you should set a base-Tag to handle relative links.

Example:

config.baseURL = http://www.yourdomain.tld/

Documentation:

4
  • You should not use baseUrl, because it creates lots of trouble. Use config.absRefPrefix instead.
    – pgampe
    Dec 6, 2012 at 17:57
  • @pgampe Which trouble? Can you be more specific?
    – Shufla
    Dec 7, 2012 at 13:42
  • Thanks to both of you - but it had set baseUrl before and then learned about absRefPrefix which solved the problem. As I also wrote in my reply above ;)
    – MBaas
    Dec 7, 2012 at 14:33
  • You get problems with realurl and also you might get interlink problems. In general, you should use absolute paths in URLs unless there is a good reason to use relativ paths.
    – pgampe
    Dec 7, 2012 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.