5

I want to get <a href="http://site.ru/node/123">New product</a> from l(), and I call it as l('New product', 'node/123'), but this function generates a URL that is not absolute.

How can I generate an absolute URL with l()?

22

You can make a link absolute with:

l(t('New product'), 'node/123', array('absolute' => TRUE));

See l() and url() for more.

2

Check out l() and the options in url() for how to construct a link with or without http: but basically you need to set the absolute option to TRUE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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