Strip Bits

Makes nested embeds easier to use in multiple templates.

Guess it.

Guess it.

Download

Overview

This does one simple thing. It strips the following words out of a provided variable: _detail, _archive, _landing.

Example use:
You have template code that is almost identical for the Articles and News section of your site, except the weblog name is different in each template. You can turn that common code into an embed, and pass in the weblog name as a variable (weblog_name=“news”) Unfortunately, if you have multiple levels of embeds it can be difficult to keep all of the embed variables straight several layers down. If your template name is based on the short name of your weblog, you can use this plugin “guess” the name of the weblog from the template name in the page’s url_title.

If, for example, you have a weblog named “news”, and a template called “news_detail”, this plugin can shorten the word “news_detail” and output the word “news” in the exp:weblog:entries tag. As i mentioned, this is probably really only useful if you have multiple weblogs using the same custom fields, and you have lots of nested embeds. So, all three of you out there that find this useful, cheers!

If you try this plugin out, and would like additional word segments removed by default please let us know what they are. Also, if you want us to go overkill, and actually look up blog names to make sure they exist, let us know, we can add that too.


Download

Categories:
ExpressionEngine, Plugin

1. Requirements

This has been tested on ExpressionEngine 1.6.5+

2. Installation

Upload this file to the plugins folder of your ExpressionEngine installation

3. Parameters

 

Parameters:

segment- a word or segment variable that needs to be tested. _detail, _archive, and _landing will be stripped, leaving you the beginning of the segment. 

4. Usage

{exp:bn_guess_blog_name segment="{segment_2}"}

Version 1.0.0

Initial release