ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

[BUG?] Categories adds C1, C2, C3 etc to path in "linear" mode.

April 15, 2012 8:03pm

Subscribe [2]
  • #1 / Apr 15, 2012 8:03pm

    Sven T.

    21 posts

    Hi,

    let me show you some code:

    {exp:channel:categories disable="categories|member_data|pagination" style="linear"}
           <li><a href="http://{path=storefront/find}/{category_name}">{category_name}</a></li>
    {/exp:channel:categories}

    After reading documentation here: http://ellislab.com/expressionengine/user-guide/modules/channel/categories.html#id5 where it says:

    A “linear” category is one that shows a pure list with no HTML inserted

    I was under the impression that I will get a naked list of categories and nothing will get manipulated. So I should see this HTML output:

    <a href="http://domain.com/index.php/storefront/find/mycateory">http://domain.com/index.php/storefront/find/mycateory</a>

    instead I am getting this

    <a href="http://domain.com/index.php/storefront/find/C7/mycateory">http://domain.com/index.php/storefront/find/C7/mycateory</a>

    My understanding is that the “C7/” part should not be there. (Bug?) - how do I get rid of this while still having access to the custom fields of the categories?

    Sven

  • #2 / Apr 16, 2012 4:17pm

    Dan Decker

    7338 posts

    Hi 40FS,

    Sorry for the confusion! “Linear” in this context refers to the output of lists or not, what you are seeing is the expected behavior.

    With categories in URLs, ExpressionEngine needs *something* to trigger category behavior. By default, that is “Cxx” like you are seeing. Without that, ExpressionEngine has no way of knowing you want to deal with categories, unless explicitly stated in your tag parameters.

    You can change this in Admin->Channel Administration->Global Preferences
    Set “Use Category URL Titles In Links?” to yes, and then choose a “Category URL Indicator” that suits your needs.

    That word will then be the trigger word in your URLs to let ExpressionEngine know you are wanting to use categories. However, that word will now be added automatically in place of “Cxx”

    Cheers,

  • #3 / Apr 16, 2012 5:22pm

    Sven T.

    21 posts

    Hi Dan

    thanks for coming back to me so fast with this issue.

    Sorry for the confusion! “Linear” in this context refers to the output of lists or not, what you are seeing is the expected behavior.

    I respectfully but strongly disagree. 😊

    The expected behavior of

    {path='aaa/bbb'}

    should be

    <a href="http://mydomain.com/index.php/aaa/bbb">http://mydomain.com/index.php/aaa/bbb</a>

    and nothing else. Don’t you think? [1]

    There seem to be zillions of reasons why one might want to give out a linear list of categories and construct ones own path.

    At any rate - I need to get rid of this “sufix” in the path in this template. Any idea how I can construct a clean site index without messing with the global settings of the categories? Do we have access to CodeIgniter features like base_url() or site_url() under EE?

    Thanks

    Sven

    [1] If I am really wrong on this, then the documentation should be at least corrected and mention that a {path='site_index'} inside categories tags will produce different results from what it produces within channel tags.

  • #4 / Apr 19, 2012 1:08pm

    Dan Decker

    7338 posts

    Hi Sven,

    [1] If I am really wrong on this, then the documentation should be at least corrected and mention that a {path=‘site_index’} inside categories tags will produce different results from what it produces within channel tags.

    The context of using {path=} *in categories* means path will output “category paths”. Those have *always* included the category trigger word, or the “Cxx” URL indicator. If you use path in the context of categories, ExpressionEngine expects you mean to build your link “categorically”. ExpressionEngine path variables adapt to the context of the tag they are used in.

    However, you have 2 variables that you can use to build links according to however you like:

    {homepage}
    --or--
    {site_url}

    So you can build:

    <a href="http://{homepage}aaa/bbb">Link</a>

    Cheers and thanks for your input! It’s much appreciated!

  • #5 / Apr 19, 2012 1:22pm

    Sven T.

    21 posts

    Hey Dan

    well the ”...it has *allways* done this…” is a tricky thing for new users, lol - I am pretty new to EE, though using Codeigniter for many years, so I was expecting {path="xx/yy"} to behave like base_url() and THANKS(!) you put me on the right track.

    Seems what I was looking for is

    {homepage}

    - which I didn’t even know existed.

    Thanks again Dan - great help!

    Sven

    PS: We should drop a word in the docu anyway. It’s not clear that it is context depended…

  • #6 / Apr 20, 2012 3:58pm

    Shane Eckert

    7174 posts

    Hey 40FS,

    Glad to see that Dan was able to help you out!

    If you need anything else, please just let us know by opening a new thread.

    Have a great weekend!

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases