Tom
Tom

Reputation: 1607

How to get the baseURL in a Typo3 template

I defined with typoscript the baseURL with the following code:

page.config.baseURL = http://www.website.nl/

Now I want to use the baseURL in the html template for a reference to a image. How can I add this url to the template? Tried the following but is not working.

<img src="{baseURL}images/sicma.png" width="70" height="28" alt="sicma">

Upvotes: 0

Views: 6515

Answers (1)

Urs
Urs

Reputation: 5122

Put it into a constant first:

baseURL = http://www.website.nl/

then use it in setup

page.config.baseURL = {$baseURL}

temp.logo = TEXT
temp.logo.value = <img src="{$baseURL}images/sicma.png" width="70" height="28" alt="sicma">

Of course, you have to assign temp.logo to the template.

But isn't baseURL precisely there so you don't have to write absolute paths?

Upvotes: 3

Related Questions