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

Category URL Indicator in template

Development and Programming

Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

What’s the code to retrieve the current “Category URL Indicator”? Wanna use it in a template so I don’t have to manually edit this, incase I change this setting in the future.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

Hi Swedie

If you’re in the context of a channel:entries loop you can just use the {path} tag inside the {categories} tag pair. So something like this would work:

{exp:channel:entries channel="articles"}
Title: {title}
Categories: {categories}<a href="http://{path=articles}">{category_name}</a>{/categories}
{/exp:channel:entries}

So if your “Category URL Indicator” was set to “cat” the URL above would end up something like “/index.php/articles/cat/category_url_title”

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

Oh, I totally missed that {categories} was a pair and it was required in order to show the category_name 😊 thank you

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

You are very welcome.

Here’s the link to the documentation of the tag: http://ellislab.com/expressionengine/user-guide/modules/channel/variable_pairs.html#var_categories

It’s a tag pair because you can have multiple categories for a given entry.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

Thanks again.

While you are at it.

What’s the function to automatically get the fuill URL to the current entry? I mean, I am listing all my news, and the title should be linking to a page where I show the full news body.

Is it something like {path='name of entry'} ? tried, but no worky.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

Another quetion. I have turned off to use index.php through both the config.php file and having the .htaccess file. But the CMS itself still adds index.php everywhere. For example the pagination function and “View” template etc.

What have I missed?

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
What’s the function to automatically get the fuill URL to the current entry? I mean, I am listing all my news, and the title should be linking to a page where I show the full news body.

ExpressionEngine allows you to use a variety of “indicators” in the URL for a given entry. Here are a few options:

http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_entry_id_path http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_permalink http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_title_permalink http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_url_title_path

As long as I’ve been using EE I’ve never understood the difference between the last two links. I’ve used {title_permalink=''} for years and never opted for an alternative.

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
14 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team
Another quetion. I have turned off to use index.php through both the config.php file and having the .htaccess file. But the CMS itself still adds index.php everywhere. For example the pagination function and “View” template etc. What have I missed?

If you go to Admin > General Configuration what does the Name of your site’s index page field have for a value?

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie
What’s the function to automatically get the fuill URL to the current entry? I mean, I am listing all my news, and the title should be linking to a page where I show the full news body.
ExpressionEngine allows you to use a variety of “indicators” in the URL for a given entry. Here are a few options: http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_entry_id_path http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_permalink http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_title_permalink http://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_url_title_path As long as I’ve been using EE I’ve never understood the difference between the last two links. I’ve used {title_permalink=''} for years and never opted for an alternative.

It doesn’t appear as if it helps out creating the channel and category. Only makes a full URL where site URL and entry short title is combined. You still have to type manually (or code) the channel and category.

       
Swedie's avatar
Swedie
61 posts
14 years ago
Swedie's avatar Swedie

What would your approach be to achieve the following type of URL: /channel/first_picked_category_name/entry_name. Would it maybe even be possible to remove the channel and go straight to category?

       

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.