Giter VIP home page Giter VIP logo

cfwheels-linktodefaulttitle's Introduction

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

Parameter Type Required Default Description
enabledFor string false Set 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

Parameter Type Required Default Description
route string false See documentation for linkTo
action string false See documentation for linkTo
controller string false See 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

Parameter Type Required Default Description
route string true Name of a route that you have configured in config/routes.cfm.
paramVariable string true Name of a variable you have defined within your route

cfwheels-linktodefaulttitle's People

Contributors

lfabbric avatar

Stargazers

Charley Contreras avatar Ivan Ionut avatar

Watchers

James Cloos avatar  avatar

cfwheels-linktodefaulttitle's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.