I need to use a View as a 'Content Type' in Drupal 7 - drupal

I'm creating a view that needs to display two content types - a normal content type, and a view. The view needs to display three items in a row - the first two items of the normal content type are the first two items in the row, and the view needs to be the third.
I have tried Viewfield and Views Field View, and neither have done what I need them to do. I need to be able to add the view as one of the 'Content Types' that the view is picking up.
Is there a way to do this Viewception?

So, if I'm getting this right, you need a view to display a normal content type, and then a view along with it?
You can always make a view of the content type, and then attach another view to it.
What is the source of the attached view's data?

man dont do this, it will be very slow query and it will kill your webserver after a few page requests
you need to build this as a custom block with a custom query (or event multiple queries), but also check your query speed. leave me a message when you need help with building custom block or building the query

Related

How to display event's views block inside another content type's content section with only events related to that content alone?

I am working on a drupal7 site. The scenario is that, there are 2 content types namely singers and events. When i am adding an event, i need to add an event to a singer, so that when i am viewing a singer's node page, i can see block containing events related to that singer alone.
I have done the events block inside the singer's content page(Using the views block). But it displays all the events and i want to display the only the events related to that singer alone. I have tried to make it using term reference or some other stuff. But nothing have worked out. Can anyone help me out to get this scenario working. Thanks in advance.
First of all, you need to link those two content types using Entity Reference module. Have a look at this answer, where I have just explained how to do so to another user.
I assume your block is being shown as a view from Views Module. However, up to now you have not been able to filter the results by singer. Once you have properly linked both content types, you will have to edit your view and add a contextual filter. When I first faced this problem, I used this guide to solve my problem. Basically you filter the Event list to show only those whose "Singer" id is the n-th parameter in the URL (node/nid).
First, why term reference when you have 2 content types? Inside your singer content type add node reference to event content type. The same thing as term reference, but obviously, you have to reference a node, not a term.
Second, in your view you must have the contextual filter that takes singer id.
Third, I'm not sure can that work with block display, but I'm sure it works with embedding view, so my suggestion is to created view display of "embed" type and to embed it directly into singer content type template. This way you can pass singer id (you have it available there: $node->nid) parameter easily.

How to provide a button which will change my current page content to an previous page in drupal

I'm making a site wherein I want to show the current course that I'm gonna teach to my pupils.In this page there should also be links provided to my previous courses. Now when I'm done with this course I want to transfer it to a previous course or rather automatically create a link for it and get the new course content in it's place. I just think doing manually is kind of stupid. Rather I want to have a form where i can create my new course then click on make current course as previous and this course as new whenever i wish.How can I do this.Is this even possible
Pretty open question ... One way would be to work with views when showing a node.
In the view you should use a custom php field, which collects the record (nid) within the course-node table. And then create a link using the drupal path_alias function or by using node/nid ...
You could use panels-module as well. Where you have a view with the latest course, and under the latest course you have a view of a link to the latest course -1 . (I think you can set an offset in views to get the previous course) The view should accept an argument, namely the nid of the currently loaded node.
If you use this method, do check if your panels is giving the arguments to the views module.
Another way would be to use node reference as to what is the previous course (but you don't want it to be manual). The advantage of node_reference is that you don't need to enter your courses in a certain order. If you make it automatically, then the order in which you fill in the courses should be correct.
Easy man. Just create a content type called "course" and using CCK, add all the fields to capture information you want about the course.
Now you have the content. Using Views, create a simple view page displaying course content type and sort it on descending order, set it to display one item at a time and add a mini pager. That way the new course will be the first one displayed and the other ones will be behind it. You might need to customize the pager a bit ^^

Concatenating 3 views in one page

how could I concatenate 3 views in one page ?
Should I use blocks ?
You can use blocks, but Views provides an attachment display as well. Attachment displays can be attached other other displays within the view. So, you could create your base view, then create an attachment display that attaches to the base view, and then create a second attachment display which attaches to the first attachment display.
Attachment displays are good if each view is really just another way to view the same query (like, a summary view and a detail view). But if you wanted to combine three disparate views, blocks would be the way to go. Either create a block display for each view and add them to the same region in Site Building -> Blocks, or create a page display for one of the views and block displays for the other two.
A third option would be to use View Reference, which lets you reference views as CCK fields, if you needed the views to part of a node.
It probably depends on your layout.
if you want to embed a view in somewhere else besides your block regions, you could try the embed views module I also believe the the panels module has a much more dynamic way of rendering multiple views on the page (but flexibility also adds some to the complexity)

Drupal: Content in blocks from node_reference fields?

After only a few weeks of working with Drupal I've come up with a recurring problem, which I don't really have an optimal solution to, so I'm hoping that someone here might be able to give some best practice pointers.
What I have is a region inside my node.tpl.php, which is populated with blocks that display content from two different CCK fields of the type node_reference. This works fine when displaying a single node. The problem appears when I need to use a view.
For example, lets say I have a news listing, and a single news item view. When I display the single news item I can use the news node node_reference field to reference whatever material I would like to have in my sidebar, but when on the news listing view I would like to reference nodes separately. What would be the best practice to solve this?
I'm having a few ideas, but none seem like the logical choice, how would you do?
My understanding of your problem is that you don't want the blocks to display on the view page and you want the block information displayed inline with the node.
The first part is easy, you can modify the block visibility settings to not show up on the path where you have the view.
The second part will depend on how you set up your view. If you are using fields you can simply add fields for the node_reference and they should display. If you are using a node view, you will have to override the template and create a template which displays the node reference field.
If you want further explanation please comment and I can clarify
After reading my question I realize that it was explained pretty badly, so I'll try again, and also tell how I solved it.
The Problem
On normal "pages" (when displaying only a single node), I have a sidebar that shows something similar to banners, which are either random, or I can select one or many that should always be displayed on the sidebar. This is solved easily when displaying a single node, using a CCK node_reference field. The problem is when using a View that displays multiple nodes, for example a news listing-
The Solution
In my case I could solve this by creating additional fields on my default Page content-type. These fields were called view, display and arguments. In my tpl.php I then embedded the news listing view inside a page, lets call it News. This way I gained great flexibility, and also helps the News page to know where it is located in menu structure.
Final comments
I have yet to discover if there are any drawbacks or dangers in doing this way, but if there are, feel free to share them with me :)
I tend to want to create my own modules, which create blocks and reference the database directly. Then I put the blocks inside of panels, this seems to be more flexible for me than using views and cck fields etc ...

Drupal: How to show specific view in a particular block

Let's suppose I have created a view that shows some kind of stories.
But I want to show this view in a left-hand bar — not a link to the view, but the view itself.
How can I connect my new view with a fixed block position?
I want to be able to show real view data in various places on my page.
Is it possible or I am limited only to central area and links to views from menu?
Using Views 2.x for Drupal 6.x it's simple to create a block from a view. Every view has a set of 'default' settings and some number of display settings. A display can be a page, a block, a feed or anything else that creative module authors.
To make a block from your view, you just "Add Display" of type "block", override any settings that you want changed in the block (IE - display less items, just a node title, whatever). You then have a block that you can place like any other Drupal block.
edit: Answer to "Can you limit stories to ones that are tagged"? Sure thing. You just add a filter for Taxonomy terms.
Getting a view to display in a block is easy. Once you have created a view and assigned the view as a block position you simply head to blocks in your admin and you'll see the view.
Just select the block and save it. Simple.
If your view doesn't show, check your filters and that the view fields are correct. Usually if they are not showing it is something simple like selecting content published = yes.
You can create views as pages or blocks. As you're not telling exactly which Drupal/Views version you're working with, all I can tell so far is that, after you create the view, you can tell it to display as a block or as a page.
Then go to the blocks settings and set that to the position you want.

Resources