Generate fields in content from other content values? - drupal

I want to generate fields in a content from the values of other content.
Specifically, I have a list of "players" stored as a content type, and a separate content type called "Events". Events list the rank of each player that participated. On the "player" content, I'd like to be able to display the players wins by searching all the "events" content. Is this possible?
Also, in Views, is it possible to generate a list of all the events a player has won, as well as how many?

1) Yes it is possible with views "Advanced > Contextual Filters". Before that you have to Create a Relationship ("Advanced > Relationships") with the field of the event that contains the Player information.
2) In this case you have to set the "Advanced > Use aggregation:Yes" and then use the "Count (Distinct)" aggregation in any field in the results.
If your Drupal level is not too high with views module better start with some learning tutorials like these from here: https://drupal.stackexchange.com/questions/5684/where-can-i-find-a-good-tutorial-on-drupal-7-views

Related

calling of one taxonomy from another taxonomy, so both of them have used in the same content type

Can we call one taxonomy term from another as a parent and child relation for example I need to click on product category and that show me product series page and when I click on product each series that will lead me to actual product detail means node, so I have two taxonomies category and series I am about to click on category to carry me to series page and then to click on series page to carry me to product detail page on the concern series”
no codebase problem
i am expecting that these two taxonomies may be used as i have mentioned in the question summary but, i can't do it so i hope some help in resolving this issue
Let's look at this answer, I hope it will help you.
Taxonomy terms from the same vocabulary filtered and referenced on multiple content types
To do this you’ll need to have the Entity Reference module installed. So get that out of the way quickly with drush dl entity reference -y and drush en entityreference -y if you haven't already.
First up, we need the taxonomy set up.
Let's demonstrate with the help of an image.
You’ll notice that these terms could be more or less grouped into two categories: Transport and Sleeping. One term (couchette) kinda fits both criteria and is there to exemplify the reason for not using 2 different vocabularies to handle the issue. Now we need to technically make the distinction between these terms as well and since they are entities, we can use a field for that.
So we can now go ahead and add a new field to this vocabulary of the type List (text) with whatever widget you’d like (and let’s call the field Type). You should make the allowed number of values unlimited and put the following in the allowed values list:
Edit each term and select the appropriate type. As expected, for the term couchette, you should select both options.
Now that we have our taxonomy squared away, it’s time to create a View that will handle the filtering of these terms. Because if we now add the Tags taxonomy term reference field to our content types in the normal fashion (as it is already present in the Article content type) we’ll be able to select all the terms in the vocabulary for all the content types. And that's not what we want now.
So create a drupal 7/8 View that shows taxonomy terms of the Tags vocabulary - let’s call it Tags Filter. Add 2 displays of the type Entity Reference and a filter of the field we added to our terms earlier. So for instance the first display can show the terms which have Sleeping selected and the other one can show terms which have Transport. Save the View and you can close it.
Now finally we can edit our content types and add to each a new field of the type Entity Reference with a select list widget. For the target type select Taxonomy term and under Entity Selection choose the following: for Mode, go with Views: filter by entity reference view and then select the View in question - one of the two displays which we created earlier. In the picture below, I named one of the displays

Showing count of content based on the select list values Drupal 7

I have a requirement in which I need to show some content along with its count based on values in a select list. I wanted to display the allocated,released and resigned resources of a particular department in a selected date range. Using views, date range and department fields are created as exposed filters.
Created a content type for creating resources. The Resources content type is having action as a select list with values allocated,released,resigned. Department is another select list and date field is also added.
Please help me with an answer if views module is not enough. Provide some other solutions also. I'm using Drupal 7.
I figured out how to show node count in views. In my view I’ve some exposed filters and passed my select list cck field as contextual filter. If no result available I made the view to display summary as row count. In the template file, I’m planning to do some calculations for showing the resources count in and out of the project. Please correct me if there is anything wrong in this approach.

how to limit view to just show each type one time?

I have a content type what is news, the news has a field type that is List (text) to keep different types of news. for example I have Health, Sport, Economic and etc.
So now I am going to create a block and have each of these type in that as a hyperlink.
I can do it and I created a new view block but each news_type may showing more than one time according to published content.
How to set the view (for block) to just show news_types and show them just one time?
You can achieve this by following the steps given below:
Enable aggregation under Advanced Accordion of the view
Add Nid field & set aggregation type as Count Distinct
Exclude Nid field from display
Add news type field & set Aggregation type as Group results together, in Group Column select Value option from dropdown
Remove Publishing Date from sort criteria
Please check attached screenshot for reference
You can check this question for more information, and maybe help you.

drupal views dynamic filter

I have a Drupal website where I post tournament results.
I have created a content-type where i write the result for 1 person in the tournament. So the fields are like: Date of tournament, player name, final position.
If 10 people played in the tournament, I create this content for each player.
Now, I would like to create a table with views, to list all the players in the tournament, and the various info, like player name/final position. I can do that pretty easy by adding the fields and sorting criteria in views. But my problem is, what I should do next time we have a tournament. I would like to just use the same view settings, but without having to clone the previous view, just to change the date filter-criteria.
So, I need the user to be able to view tournament page, and then see the results for that specific tournament. Then if the user go to see a different page from another tournament, then only those results will show up.
And I wish to do it in a clean way, where I don't have to clone the view and just change date.
You can achieve this by making a view with a contextual filter. The contextual filter will handle a taxonomy or node reference so that you can use only 1 dynamic view. But in order to make this work, you might want to adjust your content type a little so that it's easier for your view to filter them:
Your current content type has all the information of a contestant/player (Date of tournament, player name, final position), so it would be better to name that content type Contestant.
Then create a new taxonomy or content type: Tournament which will handle the information of a Tournament. Keeping these separated is a better approach.
So let's say you have a taxonomy: Tournament taxonomy with all your tournaments set up. Then you can add this as a term reference field in your content type: Contestant.
(Add a new term reference field: "Tournament" with widget: select list.)
Create your view:
Filter criteria -> Content:Type (=Contestant)
Page settings -> Path: /tournaments/%
Contextual filter -> Content: Has taxonomy term ID
Override title -> %1
For each taxonomy term (Tournament) you have this view now has a page. So when for example you go to http://yourdrupal/tournaments/1 it will filter your view only for that tournament.
I attached an image so that you can see how I configurated my view

Drupal 6: creating location list manually or dynamically via cms

I'm starting my first Drupal project, pretty excited :) I have a question;
the project is a hotel directory site. at sidebar I have locations list (London, Manchester, Liverpool, etc..) and filter the hotels related on location click.
So, how should I create these cities? Should I put them manually and give links manually depending on location id? or is there any better way to create this location list and linking filtering dynamically (via cms, or custom module, etc...)
Appreciate advices!!!!
This would be a good example of when to use the core (part of the base Drupal software) Taxonomy module. With Taxonomy you can set up one or more lists of terms that describe some or all of your nodes. For example, you can have a list of locations, a list of amenities (pool, sauna, golf course, etc.), and a list of price ranges (low, medium, high).
For each hotel you can select a location from the locations list, one or more amenities, and a price range. Then you can select all of the hotels that match one of the lists, using a neat feature of Taxonomy where it will return a list of those nodes.
The lists of terms are called "Vocabularies", and you'll want to create a vocabulary for each list. Go to Administer -> Taxonomy -> Add Vocabulary. Give it a name, like "Location" a description if you'd like, and choose the content types that it should be allowed to be associated with. (In your case, the hotels should probably be a custom content type that is different from the Page and Story types, but for trying this out, just pick Page for now.) There are several checkboxes at the bottom to decide on: Don't check Tags or Multiple Select, as these allow free tagging by users (images users making up city names) and also allow a node to have multiple locations. Do check the Required checkbox, as each hotel should have one.
Click Save and then click Add Terms on the vocabulary list page, and add a few locations. Then create a few hotel nodes (Pages for now) and you'll see that there is a new section in the Create Content page that is a dropdown selector that contains the locations. Choose one for each hotel, and add a few hotels in the locations that you just created.
To select the hotels for a given location, you will need to know the path associated with each term. Go back to the Taxonomy admin page and choose List Terms for the Location vocabulary. On the Terms in Location page you can get the list of hotels for a location by clicking on a location's name. The resulting page's path (e.g. example.com/taxonomy/term/2) would be what you'd use in your menu for that location. Each location will have its own term number that would be at the end of the path.
This is the simplest way to use the Taxonomy module, but it works really well with other modules like Views. Using Views you can control the format of the list of hotels for each location.
For more information, see the Taxonomy documentation and especially this sub-page called About Taxonomy.

Resources