0

I have the panels module installed. So I have two types of pages:

  1. Under the Create content/Page, the basic content type
  2. Under Site Building/Pages/Add Custom Page, the page with panels

So, I've used the Panel pages all over the place and everything is easy; however, for a particular project, I have some content-types that were based off the basic Page (example 1 above).

I need to figure out how to add a view to that kind of page. There is a lot of HTML with jQuery setup to allow for a custom tab system on one page: Click on a tab and via show/hide the appropriate content shows up and adds a hash tag to the url for deep linking.

I'm guessing I will select PHP code for the input format, but I haven't found the right snippet to include a particular View within all the HTML code that is already there.

I tried to just use <?php print $content; ?> within the div for the last tab of content to see if I could get something to render but it didn't show anything so perhaps this isn't the right way anyway?

Some notes

My view has four displays and I need to call the one "ISO 14001 docs" but, the view has an argument of "(Document) Content: Link" so that is probably why I have not been successful.

I've tried the following code, but I'm not getting anything and I'm not sure how to add that type of argument in this kind of call.

$viewName = 'sc_file_view';
print views_embed_view($viewName);
2

You can use Views Reference module that will give you a cck to choose from selected views. This will use with each type of content.

For a same view in all content of content type you will need to create a template file node--type.tpl.php and paste your code to include the view.

0

To embed a view with PHP use the following:

$viewName = 'sc_file_view';
$displayId = 'block_3';
$viewArg = 1; // Your view argument goes here
print views_embed_view( $viewName, $displayId, $viewArg );

The display ID is usually something like 'page_#' or 'block_#', it would not be named "ISO 14001 docs". You can find your $displayId by reading this link: How do I get the display id of a view in Drupal 6?

  • Hmm, doesn't work for me. However, I just took out the $viewArg as my argument isn't a number; it's "Document: Content Link" and has the default "Node ID from URL" checked. Is that value needed to get output with this snippet? – kelly johnson Sep 6 '13 at 15:26

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.