0

I've been tasked with adding a page to an existing Drupal (version 7.15) site. I know next to nothing about Drupal or PHP so I've been struggling a bit.

I've created a page with 2 panels and am trying to use the "custom content" option to display the title field for each entry of a specific content type in one panel. And in the other panel, I would like to display all the fields for each entry.

For instance, the first panel thus far contains:

<div class="open-positions">
  <h2>Open Positions:</h2>
  <ul>
    <li></li>
  </ul>
</div>

And I'd like to know what PHP code I'd need to use to make each <li> tag contain the titles for my content type. The other panel would be somewhat similarly formatted in that there would be markup enclosing each field, but I do not know how to get the entries from the database, and then display specific fields from that entry.

Thanks.

3

If you can at all avoid it, the direction you've started in is not the solution you want. Panels is not for handling content, but context.

What you want instead is a Views content pane. Explaining Views in detail is beyond the scope of this post, but here's the general outline.

  1. Install Views and Ctools.
  2. Enable "Views UI" and "Views content panes".
  3. Create a new View
  4. Add a filter on node type so you get only the right content type.
  5. Add title as field. Then repeat the View creation above but add the rest of the fields.
  6. Go into Panels and add both Views in their respective regions.

Much much more info about Views in Taming the Beast: Learn Views with NodeOne.

1

Read about Views. You can easily create a Views blocks with nodes list and put it inside panel.

1

Aperture,

I think you should create 2 views one which lists just the title and the other one displaying the rest of the fields. After creating the 2 views you can call them in panels page.

You will need to download and enable ctools (Views content panes), views and panels modules.

Create a new view at admin/structure/views with type content pane.

Once done with views, it will appear in panel pane to add to the page.

Deepak

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.