FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

CFWheels LinkToDefaultTitle

v0.0.9 Public

Plugin: LinkTo() Show Default Title

Purpose

This helper plugin will automatically display the page title when using the linkTo() function.

Usage

#linkTo(route = "terms")#

// results
<a href="/terms">Terms and Conditions</a>

Configuration

Within the config/routes.cfm page, added a new parameter to the addRoute method called linkToText.

config/routes.cfm ---------------------
    addRoute(
        name="about",
        pattern="/about",
        controller="pages",
        action="about",
        linkToText="value1" // new param
    );

    // or

    .get(name="about", pattern="/about", to="Pages##about", linkToText="value1")

Parameters

ParameterTypeRequiredDefaultDescription
enabledForstringfalseSet the default text for the linkTo method.

Included Functions

$ltdt_getRoute()

Returns the route name based on the action/controller provided.

Usage

config/routes.cfm
    addRoute(
        name="terms",
        pattern="/terms",
        controller="pages",
        action="terms",
        linkToText="Terms and Conditions"
    );

    or 

    .get(name="terms", pattern="/terms", to="Pages##terms", linkToText="Terms and Conditions")

//some controller or view
    $ltdt_getRoute(action="terms"); // return terms (when on the pages controller)
    $ltdt_getRoute(action="terms", controller="pages"); // return terms
    $ltdt_getRoute(route="terms"); // return terms

Parameters

ParameterTypeRequiredDefaultDescription
routestringfalseSee documentation for linkTo
actionstringfalseSee documentation for linkTo
controllerstringfalseSee documentation for linkTo

$ltdt_getRequestedRouteParam()

Returns a variable defined for a specific route.

Usage

config/routes.cfm
    addRoute(
        name="terms",
        pattern="/terms",
        controller="pages",
        action="terms",
        linkToText="Terms and Conditions",
        someAbstractVariable=15
    );

//some controller or view
    $ltdt_getRequestedRouteParam(route = "terms", paramVariable = "linkToText"); // will return "Terms and Conditions"
    $ltdt_getRequestedRouteParam(route = "terms", paramVariable = "someAbstractVariable"); // will return 15

Parameters

ParameterTypeRequiredDefaultDescription
routestringtrueName of a route that you have configured in config/routes.cfm.
paramVariablestringtrueName of a variable you have defined within your route

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
0.0.9 Mar 19 2018 10:46 AM Mar 19 2018 10:46 AM
Version History
0.0.8 Mar 19 2018 10:38 AM Mar 19 2018 10:38 AM
0.0.7 Mar 19 2018 09:41 AM Mar 19 2018 09:41 AM
0.0.6 Mar 16 2018 01:08 PM Mar 16 2018 01:08 PM

 

  •   Landon Fabbricino
  • Published
  • 0.0.9 is the latest of 4 release(s)
    Published
  • Published on Mar 19 2018 10:46 AM
No collaborators yet.
 
  • Mar 16 2018 01:08 PM
  • Mar 19 2018 10:46 AM
  • 319
  • 0
  • 0