Search code examples
drupal-7drupal-views

Drupal 7 - show categories


I have created some "Basic Pages" like page 1, page 2, page 3 etc in Drupal 7. I have also created a view named "categories" based on this assigned it in a block. Now I want to show the list of categories exactly as below:

<h2 class="sidebar1">Main Menu</h2>
<ul>
  <li><a href="#">page 1</a></li>
  <li><a href="#">page 2</a></li>
  <li><a href="#">page 3</a></li>
</ul>

Please help me in this regard. Should I create any view tpl file for this or I need to modify the templates. If so, how can I modify the template files?

Please find the attached screen shot of the view.

enter image description here


Solution

  • Under the Format label, you have to click "Unformatted list" and then select "HTML list." This way, the view's results will be displayed with the desired HTML format.

    Under the Fields label, edit "Content: title" and make sure you check the checkbox "Link to content". This way the name of the basic page will automatically be rendered as a link to the page it represents.

    Hope it helps.