Drupal - How can I get an absolute path to a theme?

The base_path() function would return the base bath of the Drupal installation

Returns the base URL path of the Drupal installation. At the very least, this will always default to /.

and path_to_theme() will return the path to the current theme.

Return the path to the current themed element.

It can point to the active theme or the module handling a themed implementation. For example, when invoked within the scope of a theming call it will depend on where the theming function is handled. If implemented from a module, it will point to the module. If implemented from the active theme, it will point to the active theme. When called outside the scope of a theming call, it will always point to the active theme.


Mohammed Shameem's answer is correct, but if you're really looking for the correct way (the Drupal way) to render a custom template, do not use include() or require_once(). Instead, use the Drupal theme system. Changing the output of something that already has a template is easy, see Overriding themable output to learn how to override a template. If there is no template yet, you would have to learn about hook_theme, registering your own templates, and render arrays.

Tags:

Uri

Theming

7