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.

Getting template name

October 28, 2014 1:59pm

Subscribe [2]
  • #1 / Oct 28, 2014 1:59pm

    I’m making my own HTML sitemaps by assigning each of my entries to categories.

    {exp:category_sorted_entries channel="services|pages|professionals|case_studies|ebooks" style="nested" group_id="10"}
        {category}
            <h3>{category_name}</h3>
    <p>    {/category}<br />
        {entries}<br />
            <a href="http://{site_url}{url_title}">{title}</a></p>
    
    <p>    {/entries}<br />
    {/exp:category_sorted_entries}

    The issue I have is that my entries use different templates. So even though this code spits out all the links I have assigned to particular categories, I can’t differentiate which template to send the url to. So I’m left to go into each entry and make sure I set the pages URI and template accordingly in the pages tab.

    I’m using the pages module, not structure for the site.

    Is there any way to find out what template an entry is using? This way I can do a few conditionals and maybe get this working without having to assign the pages URI and template strictly in every single entry of my site.

  • #2 / Nov 04, 2014 9:10am

    Boyink!

    5011 posts

    In your channel setup you can identify the ‘single entry template’ for each channel.

    Then look at the comment_url_title_auto_path variable:

    https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel_entries.html#comment-url-title-auto-path


    I wrote this for EE1 but the basics are still the same for EE2:
    http://www.train-ee.com/courseware/free-tutorials/comments/working-with-combined-weblogs

    ETA: this assumes that the entries in each channel use the same template. MIght not work in cases of extensive use of the Pages module.

    What’s your purpose for using the Pages module anyway?

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

ExpressionEngine News!

#eecms, #events, #releases