0

I have made a content type with several fileds that contain data. Now I don't want this data to be displayed flatly on the page when people see that node.Instead, I want to make a side menu (within the node) that contains links and connect it to the seperate sections of the data on the node.

What's the best way to do this?

Ashish Sharma
  • 83
  • 3
  • 14

1 Answers1

0

You can create a views block for that and display it only for this node type.

In this views select a field display of that node type. For each field go to REWRITE RESULTS > Rewrite the output of this field. Here rewrite the output as anchor link, eg <a href="#myid" name="myid">Anchor link text</a>.

Then you have to add the same ids in the node display fields. You can do this through the field.tpl.php files, preproccess functions or any other theming method.

Community
  • 1
  • 1
TheodorosPloumis
  • 2,396
  • 1
  • 17
  • 31
  • Okay I got the first part of your answer its pretty neat! and easy to do with views. Now if I add these ids to field.tpl.php, will the Drupal render them on the "node" page or views block? I need a nice little side menu made up with these links. How do I collect them to form a menu? – Ashish Sharma Aug 06 '13 at 16:17
  • On the node only. The views will display overwritten values. But in any case views uses different templates with fields display. For the fields as links select an Unformatted list (ul) display format and style the rows (li) as you prefer. – TheodorosPloumis Aug 06 '13 at 19:27
  • nice!! thanks thedoros..let me try that. I'll be back with results. – Ashish Sharma Aug 07 '13 at 07:04
  • @theodors can I trouble you a little more? How do I get the views to display on all the nodes of that content type? Not as a block, but as a simple page? i.e. replace the output of that node with the output of a view. – Ashish Sharma Aug 07 '13 at 08:07
  • 1
    Check this http://www.verbosity.ca/drupal-drupal-7-drupal-planet/overriding-drupal7-node-display-views or Google for "drupal 7 views override node with views". Also, if the answer was helpful you can give it some upvote or select it as accepted. – TheodorosPloumis Aug 07 '13 at 08:59