GithubHelp home page GithubHelp logo

westhouseit / hacksaw-for-expressionengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brettdewoody/inactive-hacksaw-for-expressionengine

0.0 2.0 0.0 13 KB

Allows you to create excerpts of your entries by removing HTML tags and limiting the content by character count, word count or a specific marker you insert into your content.

Home Page: http://www.ee-hive.com/hacksaw

hacksaw-for-expressionengine's Introduction

Version: 1.08

Hacksaw takes your entry's content and whittles it down
to a more manageable size. It strips the HTML and limits 
the excerpts by character count, word count or cutoff marker.

To use Hacksaw simple wrap the content you want to truncate
with the exp:eehive_hacksaw tag, like this:

{exp:eehive_hacksaw}
   {your_content}
{/exp:eehive_hacksaw}

There are several parameters you can use to control how
the content is truncated. These options are:

chars   = ""     // Limit by number of characters
words   = ""     // Limit by number of words
cutoff  = ""     // Limit by a specific cutoff string
append  = ""     // String to append to the end of the excerpt
allow   = ""     // HTML tags you want to allow. Ex allow="<b><a>"

For example, if you want to limit your excerpt to 100
words you would do this:

{exp:eehive_hacksaw words="100"}
   {your_content}
{/exp:eehive_hacksaw}

By default Hacksaw will strip all HTML from your excerpt.
If you would like to keep some basic HTML you can use
the 'allow' parameter to keep specific HTML tags. For
example, let's say you want to keep <p> and <b> tags:

{exp:eehive_hacksaw words="100" allow="<p><b>"}
   {your_content}
{/exp:eehive_hacksaw}

This would strip all HTML except paragraph (<p>) and
bold (<b>) tags. 

Another way to limit content is by a cutoff string. This
is similar to the way Wordpress's "more" feature works.
In your content you could add a specific string to indicate
the spot you want the excerpt to stop. Let's say you use 
"<!-- END -->". To cut the excerpt off at this location
you would do this:

{exp:eehive_hacksaw cutoff="<!-- END -->"}
   {your_content}
{/exp:eehive_hacksaw}

The 'cutoff' parameter can be coupled with the 'words' parameter
in case you forget to add the cutoff string to some of 
your entries. This way the excerpt will be truncated at
the cutoff string, OR after X words.

You can add any string at the end of the excerpt using the
'append' parameter, like this:

{exp:eehive_hacksaw words="100" append="..."}
   {your_content}
{/exp:eehive_hacksaw}

This would append "..." to the end of the excerpt.

For complete documentation go to http://www.ee-hive.com/hacksaw

hacksaw-for-expressionengine's People

Contributors

westhouseit avatar

Watchers

James Cloos avatar  avatar

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.