I have a node called "Student" I have another node called "Personal details".
I have made relations between them using entity reference module.
Now I am creating a view to get details of all students. I created a view of students and selected Content "Personal details" on fileds of the view. But I am only getting the id of the "Personal details".
I am struging to get the name and other fields of personal details node.
I used Relationships-> Entity Reference: Personal details and added content entityreference in fields but it is not displaying aything when i printing the view using get_view API.
Please help me on this.
I think this should work. Try to create a view for all types.
Select the fields that you want to display (the fields from students and personal info ). Chose to display both Id's from Student node and from the Personal info node, but make 1 of them invisible, to not be shown. ( you will understand why in step 4 ).
Add a filter, the Global: Fields comparison.
Select the two fields that have to be equal (the ID's).
Related
I have a Drupal 7 question. I would like to display certain pieces of information from my current node using a view.
I can use views to display information from other nodes easily by setting filters and other sorting features. That's no problem. However, I want to display information from the node which is currently opened. So, for example, if I'm on a page (node: 117, title: news), I can display all the images from that page, plus captions, by creating a view.
The logic, I suppose, would be to create a view with a filter (or contextual filter) stating that the node has to equal the current node, but I don't know how to do that.
Does anyone have any advice? How do I instruct a view to display information from the node which is currently open?
Thanks!
Edit the view
Add Content: Nid in contextual filter
In contextual filter options
WHEN THE FILTER VALUE IS NOT AVAILABLE
Select "Provide default value"
Type: Content ID from URL
Now the default argument will be the nid of the current node.
I'm creating a simple app in CakePHP that will be used to record members in a youth group, the idea being that many units around the country (similar to say Scout troops) can login and record new member details, and these records are available at a state and national level.
One of the fields recorded is the school that the new member attends, rather than just enter a text field the school is in a related table and the member 'belongsTo' the school. This gives a nice little drop down field to select the school, however given there are thousands of schools in the country the schools list is by no means complete. To simplify data entry, rather than have the person entering the data either skip that field or have to create the school first, THEN add the member, I'd like to have the option of being able to create the school entry in a modal popup then returning back to the new member entry and having the new school available in the drop down.
I've found a few simplified examples in stack overflow but nothing that meets this need.
Instead of a dropdown of a distracting modal, why don't you simply use a autocomplete/typeahead field?
There are several examples arround like the jQueryUI autocomplete or the Twitter Bootstrap Typeahead and many more if you do a search
You could even make it so that if a new value is entered it is added to the database and available for the next visitor as autocomplete
What is the best method to create a questionnaire in drupal 7?
We use multiple choice questions. (+/- 20)
Is it possible to have one question per page? How?
Is there a way to give the user the end-score of this questionnaire? How?
You will need to install a Field Group module and Views module.
Add a content type "Test1"
To the Test1, add a Text field, "Question1"
Also, add a List (text) field, enter
q1|Answer one
q2|Answer two
Repeat for more questions
Use Field Group module to divide questions by pages.
To take the test, add Test1 "/node/add/test1".
To create an answer sheet, take the test and use the Node ID of the test for the next step.
Create a view, using Views. Match any taken test against the Node Id of the answer sheet. You can do so, by including a link at the end of the test, which links to "/score/%NID%", %NID% being the Node ID of the current TEST1. Create a page in views, with "/score/%" as a path. Use the Contextual Filter to get the NID from the path and match it against the NID of the cheat sheet.
You can get it more advanced by using referencing fields, via Entity API and Entity Reference modules.
Enjoy!
I'll try to explain my problem giving a little context first.
I'm building a catalog of products and to categorize them I'm using a taxonomy tree with 4 sublevels. Each product can be related with one or more subcategories.
I used views to navigate the taxonomy tree to access the products related with each subcategory. To manage the breadcrumbs in here I redefined the hook_breadcrumb() function on my template.php and this is working perfectly.
The problems start here: when I get to the last level of subcategories I have the respective products and when I click one of the products it will enter the node page of that product. At this time I lose my breadcrumb trail because I entered the node. I could get the taxonomy tree of that product to build the breadcrumbs but the problem is that the product can be related with multiple subcategory terms.
So, in order to solve this problem I think that I need to know from wich path trail the visitor arrived to the product. In other words, I need to know the last taxonomy subcategory that the user visited to enter a specific product so that I can build the breadcrumbs correctly with that information.
So, can someone help me on how to know the path that the user was before entering a node?
Thanks in advance!
You can check http://drupal.org/project/cookiecrumbs a recent project which uses browsers history to show breadcrumb
I have been trying this whole day but cant figure out... I have custom object called Dev which has many to many relationship with Accounts... I want this object Dev to show under related list of page layout of account... But it is not showing there how can i add that to related list?
Assuming you have a lookup relation from Account to Dev and also a lookup from Dev to Account (creating your many-to-many), then this will work fine.
Try re-creating your lookup relationship from Account to Dev. Then make sure that you add the related list and add to the page layouts in steps 5 & 6:
Step 5. Add reference field to Page Layouts (Yes to All)
Step 6. Add custom related lists (Yes)
That's all you need. If, however, your many-to-many relationship is unique or otherwise configured differently (with a junction table, for example) then the above may not work for you.
We always tend to use joining objects for these relationships, obviously you can show the list of joining objects as a related list, and you could display other fields from the dev object by use of formulae.
One thing we've tended to do is create an inline VF page which can then show all of the objects related to the current record.