BuzzingPixel

Ansel for Craft

Ansel for EE

Treasury

Construct

Category Construct

Dashboard (open an issue here)

All Issues

My Issues

News Contact
Log in

Logged in as

Licenses Purchases Profile Change Password Billing Portal Admin
Log Out
Software
Ansel for Craft Ansel for EE Treasury Construct Category Construct
Support
Dashboard (open an issue here) All Issues My Issues
News Contact
Log in
Logged in as:
Licenses Purchases Profile Change Password Billing Portal Log Out
Dashboard All Issues My Issues
Support Dashboard
  1. Home
  2. Home
  3. Support Dashboard
  4. View Issue

Adding 'backspace' parameter

#204 opened by Oliver Cannell (IC360)

Subscribe

Details

Complete

Public Issue

Visibility: Public
3 replies
Last reply by TJ Draper
Created 8/25/2021 6:47 AM
Updated 9/1/2021 8:42 PM
Category Construct 2.2.0
CMS Version: EE 5.4.2
PHP Version: 7.2

Description

I'm trying to output all the Categories for an Entry, within a specific Parent, like this: {exp:category_construct:categories entry_id="{entry_id}" group_id="1" parent_id="14"}{construct:cat_name}, {/exp:category_construct:categories}

...and I was really hoping a parameter like backspace="2" could be added to remove the last ", " characters of the very last category output (just like in the EE {categories} tag. Would you be able to add this in add at all? Or is there a workaround? :-)

Replies

  • TJ Draper

    Replied 8/28/2021 9:36 AM, Edited 9/1/2021 8:42 PM

    The backspace parameter is a feature of the ExpressionEngine tag parsing engine. It should just work. I don't have an easy test environment to verify that right at this moment, but if you do something like this, it should work and I'm fairly confident I tested this back when I was developing Construct:

    {exp:category_construct:categories entry_id="{entry_id}"" group_id="1" parent_id="14" backspace="1"}{construct:cat_name},{/exp:category_construct:categories}
    

    If by chance that doesn't work, you can definitely do something like this:

    {exp:category_construct:categories entry_id="{entry_id}"" group_id="1" parent_id="14"}{construct:cat_name}{if construct:count != construct:total_results},{/if}{/exp:category_construct:categories}
    
  • Oliver Cannell (IC360)

    Replied 9/1/2021 4:16 PM, Edited 9/1/2021 8:42 PM

    Using the backspace="2" parameter, seems to perform that function on every loop, rather than just the last one. However, your {if construct:count != construct:total_results},{/if} method has worked. :-)

  • TJ Draper

    Replied 9/1/2021 8:42 PM

    Ahh, actually now that I think about it, the way Construct builds the results and uses the template parser, that makes sense. Glad the other method works!

Use Markdown for formatting

Details

Complete

Public Issue

Visibility: Public
3 replies
Last reply by TJ Draper
Created 8/25/2021 6:47 AM
Updated 9/1/2021 8:42 PM
Category Construct 2.2.0
CMS Version: EE 5.4.2
PHP Version: 7.2
Cookie Policy
Privacy Policy
Terms of Service

© 2023 BuzzingPixel, LLC. All rights reserved.