We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New Extension: Entry Crumblink

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

The purpose of this extension is to display on Edit page a crumblink leading to the entry being edited. I recommend to use this extension together with Publish Tweaks extension because it cancels redirect after clicking “Save” on Publish/Edit page.

Similar functionality is already implemented in Publish Improve extension - that extension also puts a link on Edit page which leads to the entry being edited.

The difference is not between the simple link and the crumblink; the difference consists in flexibility of forming URLs.

In writing Entry Crumblink extension I strived to achieve most flexible forming of URLs. Flexibility is achieved by running weblog URL templates through a simple but quite powerful template engine.

In extension’s settings you will find a textarea for each weblog. In that textarea a template of weblog’s URL should be entered. Weblog URL templates support several single variables (some of them can have parameters) and advanced conditionals.

SINGLE VARIABLES WITHOUT PARAMETERS:

1) {site_id} 2) {site_url} 3) {site_index} 4) {homepage} 5) {weblog_id} 6) {weblog_short_name} 7) {weblog_url} - weblog URL as defined in weblog preferences 8) {entry_id} 9) {url_title} 10) {categories_number} 11) {category_levels_number}

Templates support huge number of variables of the types outlined below (level0 is the highest level of categories, level1 is the level of subcategories of highest level, etc.; category0 is the first category of certain level, category1 is the second category, etc.):

11) {level0_category0_cat_id}, {level0_category1_cat_id}, {level0_category2_cat_id} … {level1_category0_cat_id}, {level1_category1_cat_id}, {level1_category2_cat_id} … {level99_category99_cat_id}.

12) {level0_category0_parent_id}, {level0_category1_parent_id}, {level0_category2_parent_id} … {level1_category0_parent_id}, {level1_category1_parent_id}, {level1_category2_parent_id} … {level99_category99_parent_id}.

13) {level0_category0_group_id}, {level0_category1_group_id}, {level0_category2_group_id} … {level1_category0_group_id}, {level1_category1_group_id}, {level1_category2_group_id} … {level99_category99_group_id}.

14) {level0_category0_cat_url_title}, {level0_category1_cat_url_title}, {level0_category2_cat_url_title} … {level1_category0_cat_url_title}, {level1_category1_cat_url_title}, {level1_category2_cat_url_title} … {level99_category99_cat_url_title}.

15) {level0_category0_subcats_number}, {level0_category1_subcats_number}, {level0_category2_subcats_number} … {level1_category0_subcats_number}, {level1_category1_subcats_number}, {level1_category2_subcats_number} … {level99_category99_subcats_number}.

Continued in the next post

       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

SINGLE VARIABLES HAVING PARAMETERS

1) {single_field} variable can have following prarameters:

1) field
2) entry_id
3) weblog
4) url_title
5) category - category id
6) sort - "asc" or "desc"
7) format - field format (e.g. "none", "raw")

This variable can be used to output the vavue of some custom field. Parameters do not support pipe character and “not”.

2) {entries_number} variable can have following prarameters:

1) weblog
2) category
3) url_title
4) status
5) entry_id
6) show_expired

This variable can be used to output number of entries posted into certain weblog or category. Parameters do not support pipe character and “not”.

3) {php} variable which can have following parameters:

1) string - string to be run through PHP function
2) function - PHP function name
3) par1 - first argument of PHP function
4) par2 - second argument of PHP function
5) par3 - third argument of PHP function
6) par4 - fourth argument of PHP function
7) par5 - fifth argument of PHP function

Names of PHP functions which can be used as values of “function” parameter are: addcslashes, bin2hex, chop, chr, chunk_split, convert_cyr_string, convert_uudecode, convert_uuencode, count_chars, crc32, crypt, echo, explode, get_html_translation_table, hebrev, hebrevc, html_entity_decode, htmlentities, htmlspecialchars_decode, htmlspecialchars, join, levenshtein, localeconv, ltrim, md5_file, md5, metaphone, money_format, nl_langinfo, nl2br, number_format, ord, parse_str, print, printf, quoted_printable_decode, quotemeta, rtrim, setlocale, sha1_file, sha1, similar_text, soundex, sprintf, sscanf, str_ireplace, str_pad, str_repeat, str_replace, str_rot13, str_shuffle, str_split, str_word_count, strcasecmp, strchr, strcmp, strcoll, strcspn, strip_tags, stripcslashes, stripos, stripslashes, stristr, strlen, strnatcasecmp, strnatcmp, strncasecmp, strncmp, strpbrk, strpos, strrchr, strrev, strripos, strrpos, strspn, strstr, strtok, strtolower, strtoupper, strtr, substr_compare, substr_count, substr_replace, substr, trim, ucfirst, ucwords, vfprintf, vprintf, vsprintf, wordwrap.

Also the value of “function” parameter can be “parseint”; it is custom PHP function which behaves as Javascript “parseInt” function.

Single variables having parameters are parsed after single variables which do not have parameters; that means that you can use single variables without parameters as the values of parameters.

EXAMPLES OF USAGE

Here is weblog URL template for one of my weblogs:

{homepage}/site/news/{url_title}/

Here is more complicated weblog URL template:

{if level0_category0_cat_id == "170" OR level0_category0_cat_id == "175" OR level0_category0_cat_id == "176" OR level0_category0_cat_id == "177"}{homepage}/technical/entry/{url_title}/{/if}

Another quite complicated weblog URL template example:

{homepage}/ebook/general_introduction/{level1_category0_cat_url_title}/{if "{entries_number weblog="ebook_generalintro" category="{level1_category0_cat_id}"}" > 1}{url_title}/{/if}

Continued in the next post

       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

And here is a weblog URL template which might seem weird… but with Entry Crumblink extension you can have such templates!:

{homepage}/ebook/introduction{if "{single_field field="introduction1_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" == "{weblog_id}"}{/if}{if "{single_field field="introduction1_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" AND "{single_field field="introduction2_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" == "{weblog_id}"}_2{/if}{if ("{single_field field="introduction1_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" XOR "{single_field field="introduction2_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "") AND "{single_field field="introduction3_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" == "{weblog_id}"}_2{/if}{if ("{single_field field="introduction1_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" XOR "{single_field field="introduction2_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" XOR "{single_field field="introduction3_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "") AND "{single_field field="introduction4_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" == "{weblog_id}"}_2{/if}{if ("{single_field field="introduction1_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" XOR "{single_field field="introduction2_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" XOR "{single_field field="introduction3_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "" XOR "{single_field field="introduction4_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" != "") AND "{single_field field="introduction5_weblog_id" weblog="ebook_common" category="{level0_category0_cat_id}" sort="asc"}" == "{weblog_id}"}_2{/if}/{level0_category0_cat_url_title}/{if "{entries_number weblog="ebook_introduction1" category="{level0_category0_cat_id}"}" > 1}{url_title}/{/if}
       
smartpill's avatar
smartpill
456 posts
16 years ago
smartpill's avatar smartpill

Nicely done. Thank you!

       
Laisvunas's avatar
Laisvunas
879 posts
about 16 years ago
Laisvunas's avatar Laisvunas

Hi,

I released version 1.0.1 of the Entry Crumblink extension.

In this release a minor bug was fixed - PHP error being shown which was not otherwise interfering with the functionality of this extension.

       
Laisvunas's avatar
Laisvunas
879 posts
about 16 years ago
Laisvunas's avatar Laisvunas

Hi,

I released version 1.0.3 of the Entry Crumblink extension.

In this release a minor bug was fixed - again PHP error being shown which was not otherwise interfering with the functionality of this extension.

       
smartpill's avatar
smartpill
456 posts
15 years ago
smartpill's avatar smartpill

Love this extension. Just wanted to point out that the language file is missing from the latest download.

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas
Just wanted to point out that the language file is missing from the latest download.

Thanks. Fixed.

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

I released version 1.2 of the Entry Crumblink extension.

New features:

1) variables added {level0_category0_group_id}, {level0_category1_group_id}, {level0_category2_group_id} … {level1_category0_group_id}, {level1_category1_group_id}, {level1_category2_group_id} … {level99_category99_group_id}.

2) the list of weblog URL templates will be displayed in order you specified in Weblog Order extension’s settings in case you have this extension installed.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.