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.

determining category from entry_id or url_title

August 19, 2007 8:41am

Subscribe [1]
  • #1 / Aug 19, 2007 8:41am

    saul

    6 posts

    Let’s assume that every entry in a multi-weblog site has a single category
    is it possible to determine a given entries ‘category id’ from it’s url_title or it’s entry_id?

  • #2 / Aug 19, 2007 9:11am

    Ingmar

    29245 posts

    What about

    {categories}{category_name}{/categories}

    ?

    See here for details.

  • #3 / Aug 19, 2007 2:30pm

    saul

    6 posts

    Okay so I think I uncovered a problem—I was using exactly that on my local dev server - but the same code brings back zero results on a clients server

    using this very minimal template

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
     <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    
    <title>
    DVC
    </title>
    </head>
    <body>
    
    {exp:weblog:entries}
    <h3>{title}</h3>
    <p>{body}<br />
    <b>webblog:</b> {weblog_short_name} -- {weblog_id} </p>
    
    <p>{exp:weblog:categories}<br />
     <b>category assigned:</b> {category_name} -- {category_id}</p>
    
    <p>{/exp:weblog:categories}<br />
    <div class="date">Posted on {entry_date format="%M %d, %Y - %h:%i %A"}</p>
    
    <p>------------------------------------------------------------------------<br />
    </div><br />
    {/exp:weblog:entries}</p>
    
    <p></body><br />
    </html>

    I’ve tried it with the standalone {exp:weblog:categories} as well as just {categories} with the same results
    the category tags are completely ignored and even the static content within them isn’t displayed - anyone have any idea what might be going on? is it a bug?

  • #4 / Aug 19, 2007 3:56pm

    Ingmar

    29245 posts

    To be sure, it is {categories} with an {exp;weblog:entries} context, not {exp:weblog:entries}.

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

ExpressionEngine News!

#eecms, #events, #releases