ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using site_url and path variables in entries

November 15, 2012 2:57pm

Subscribe [2]
  • #1 / Nov 15, 2012 2:57pm

    jsuissa

    147 posts

    We’re working on a site which has a lot of links that will be added via entries in text fields as opposed to templates.

    The {site_url} variable doesn’t work in those instances. My concern is we would rather not hardcode links because we’re using a subdomain for testing and would have to update them all by ahnd.

    Is there any way to make the site_url and/or the path variable work inside entries?

    Or is there some other recommended solution?

    Best,

    Justin

  • #2 / Nov 16, 2012 1:36pm

    Rob Allen

    3108 posts

    If you want to create individual links, then look at Related entries, or if you need to create a list of links then the Playa module can come in useful.

  • #3 / Nov 19, 2012 3:02pm

    Dan Decker

    7338 posts

    Hi jsuissa,

    I think a 2 pronged approach would be possible.

    1) only input the “relative” part of the URL in the text field. This will only work on a one-URL-per-text field basis.

    2) then in your template, use the path or site_url variable to build the link.

    {path="{field_name}"}
    
    or
    
    {site_url}{field_name}

    This approach won’t work if you need to use these links in Textareas though.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases