Skip to content

Global views field that provides site's base url

Notifications You must be signed in to change notification settings

subhojit777/views_base_url

Repository files navigation

Build Status

This module provides a site base URL token in Views. The main purpose of this module is to create a link with absolute path through Global:Custom text option.

Usage:

  • Select field formatter in view, and add Global: Base url
  • Select Exclude from display option.
  • Create custom link by adding a Global: Custom text
  • Create link using replacement pattern like this:
<a href="[base_url]/home">My home page</a>

Why use this module:

You can also create custom links though Drupal l() function, in this case you have to use Views PHP module. The code is stored in database, hence it will not be cached. PHP execution through eval() is slow. This module eliminates this problem.

Alternatives:

Only module I found closest to this is Views BaseURL, it's in sandbox and that too it was last modified years ago, means its not maintained.