1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Showing data for category description in showlistings.tpl

Discussion in 'Templates, HTML, CSS, and Design Help' started by jason1971, Dec 27, 2013.

  1. jason1971 Customer

    Hi there,

    I am trying to figure out how to show the information added in the category description section, onto the showlistings page.

    I know it is this {$data[td].description} that calls the data, but it is not showing up.

    I have taken it out of the section below, because I want to add it elsewhere on the showlistings page.

    {if $data[td]<>""}
    {$data[td].start_link}<img src="{$data[td].image}" border="0" alt="{$data[td].name}" /></a>&nbsp;
    {$data[td].start_link}<strong>{$data[td].name}</strong></a>
    {if $data[td].total <> ''}
    ({$data[td].total})
    {/if}
    {/if}

    But I am unsure how to get it to show up.

    Does anybody have any ideas at all PLEASE

    Thanks

    Jason
  2. Mike-N-Tosh Owner

    That code doesn't work in that template, because those variables aren't available to that template, nor should they be. To see what variables are available in any given template, use the smarty {debug} in your layout.tpl template file and then view the page you want to show the variables for.
    As suggested before, it may serve you well to go through and use the online documentation.

    Bear in mind, that the showlistings(2).tpl is used to show listings, not a category from a search and can span several pages in results. Listings from a search will generally be from several different categories therefore doesn't have a single category or it's individual category information.
  3. jason1971 Customer

    Sorry Mike my mistake. What I meant to say was I want to use it in Browse.tpl (which is where I pulled it from), but I cant seem to use it just as {$data[td].description}
  4. Mike-N-Tosh Owner

    No need to be sorry, Jason.

    Unfortunately, this still will not work for you. If you look more carefully at the code where you grabbed this snippet from, you will notice that you took it from inside of a "loop" and within another Smarty function within a second smarty function. Essentially, you are trying to show data by itself that is actually part of something else.

    Think of it this way. If you had a bunch of chickens in a chicken coop and you looked inside of a window in the chicken coop, you can see some chickens. If you take away the chicken coop and just keep the window and look through it, you won't see ANY chickens.

    I'm still unclear as to what exactly your goal is here since the code you took is already in the template file that you are wanting to show it in. Unfortunately, there is nothing built in to just get a single category and it's description by itself which it sounds like you might be wanting to accomplish. You would need to build something from scratch like a Smarty plugin and then input the categoryID you want it to get and return. That would be something way beyond the scope of the forum, however.
  5. jason1971 Customer

    ok cheers for the help anyway

Share This Page