Display category field on view listing page

Discussion in 'Web Directory Script' started by Boue, Apr 30, 2017.

  1. Boue

    Boue New Member

    I have created a directory field category called 'second-title'.
    Could anyone suggest how I display the contents of this field on the view listing pages?

    Thanks
  2. Vasily_B.

    Vasily_B. Project Manager

    Hi,

    There is no easy way to display a category field on view listing page from this category.
    Probably I understand you incorrectly. Did you create a field for category or listing item?

    If it's created for listing = you can easily print it in view listing template, by {$item.FIELD_NAME} - that's it.
  3. Boue

    Boue New Member

    Hello Vasily,
    I have a category field called 'second-title'.
    Was wondering if I could display this on the view listing page.
    Thanks
  4. Vasily_B.

    Vasily_B. Project Manager

    Well, this could be done.

    You need to change the following line in you view.php file of the package:
    PHP:

    $category = $iaCateg->getById($listing['category_id']);
     
    to
    PHP:

    $category = $iaCateg->getById($listing['category_id']);
    $iaView->assign('category', $category);
     
    Now you can modify your view.tpl and use category array by this: {$category.FIELD_NAME}

Share This Page