Drupal 7 view custom templates - drupal-7

I have created 1 views which include the 5 types of content types nodes.
What i want to do is customize the view template.
The first 2 stories display in other format like complete title, summary and image
and last 3 stories only title.
How this possible using views.
Or i have to use $view=views_get_view_result() method

You can create the first 2 stories as a regular View (either a page or a block, whichever you want to use) and create the remaining 3 stories as an attachment to the first view.
In the View, you should be able to create an attachment which you can then attach at the end of the first View.
This way, you can have slightly different configurations for each view but still have them in the same View page or block like:
I've posted a lengthier, illustrated step-by-step on my blog at http://nmc-codes.blogspot.ca/2012/10/views-attachment-in-drupal-7.html

Related

Loading empty form

I have a page with 3 containers, the top will be used for search form, two the left side will have the adf form and the right a table view. One thing to note is that all the 3 sections will be using the same View Object or inturn the same table. When the page is loaded I want my form to come in the createInsert view. I tried using the invoke criteria for the creatInsertaction but this is messing up my search, since the form is empty and if i do a search in the search form the validators in the ADF form will fire and every thing goes for a toes.
Please suggest any solutions for this.
Use different view instances. Probably 1 for the search and 1 for both the form and the table.
Some basic info about view instances: http://andrejusb.blogspot.be/2011/06/understanding-adf-bc-view-object.html
You can use the same viewObject but add some viewCriteria for the search part, and use a CreateInsert in your taskflow before show the view.
use mange-Bean and do create insert pragmatically inside the constructor .

Passing Arguments from a paginated Drupal Views Page url

I have a page generated by Views which lists 5 Articles at a time. This view is paginated so that page 2 of this View will list the second batch of 5 Articles, page 3 will list the third batch of Articles, so on and so forth.
My question: is it somehow possible to extract fields from Articles listed on the page you're currently on, perhaps via the url? And I only want to them on the Articles being displayed by the page the viewer is currently on and not all the Articles.
My intent is to have a Views Block that would ...
determine what page of the paginated View above you're looking at
determine what Articles are listed on that specific page
aggregate and display the Taxonomy Terms of those listed Articles (Articles have a Taxonomy Term field) in the block
do all the above automatically as you change what page you're looking at
The way I'm going about this is to list all the the Taxonomy terms in a block which is relatively straightforward. What I can't figure out is how to filter it based on what Articles are being displayed to me in a paginated page.
I was thinking maybe this is possible to use it using the url of the paginated page which goes along this format: ?page=1, ?page=2, etc.
If anyone could just point me to the right direction, I would appreciate it. I'm also open to alternatives.
What if you created another display of the same view as your Article page view?
You could add a Relationship for the Taxonomy Terms and then the Fields in the block view would be the appropriate fields from the taxonomy terms. You'll want to setup the same Filters, Sort and Pager options for the two displays are the same. That way the results should match.
Then you might just want to hide the pager from the block view. You could do that through a custom template for that view display, or maybe a preprocess function that hides the pager for just your view, or maybe via CSS.

add content with 2 levels taxonomy in drupal

I'm new to Drupal, and I'm working with a content panel.
I want to create a news content containing a 'category' taxonomy reference field. However, my vocabulary has 2 levels and over 100 terms, so it's hard to choose an category using the simple widgets.
I don't want to create new add content panel, but the panel of Drupal. So any ideas for that?
Try using the Hierarchical Select module.
There's also a tutorial on how to use it at http://eureka.ykyuen.info/2012/05/29/drupal-7-mutiliple-selection-list-for-taxonomy-using-hierarchical-select/.
(The one caveat is that there isn't yet support for using it with exposed Views taxonomy fields.)

Drupal - 7 category/taxonomy with nodes in block

I am new in drupal 7 and I want to create one view blog in which I can list out taxonomy as category and in under that I want to display two articles and a read more link to that category. Can any one explain in details how can i do that.
If you use a content type with a Term reference field for your category, it wil automatically create pages for each category with the articles tagged with that category listed within it.
If you want to have more control over these pages generated by the Taxonomy module, you can turn on the Taxonomy Term example view in de Views UI and add and remove the fields you want to display. The layout of these pages can be edited by creating a custom template file in you themes template folder for the file page--taxonomy.tpl.php.
There you could als create an additional block display (I assume you mean block when you say blog), and in the Page settings area, you can turn on de More link, and this will display a more link when more articles are available then you have set you pager to display (i.e. Use pager - Display a specified number of items - Items per page = 2). Make sure you change de setting from For all displays to This block (override) to not override the other displays.
This block you can place in any region on any page via the Blocks UI and is should do what you want.

Drupal combine nodes and comments in view

I have a view with nodes of the type 'Note' (custom CT). I have A view with comments that are associated with those nodes. How can I combine these views into one view so that I can filter them individually on the date ?
The simple way would be to make one view with notes and comments both in it and then using contextual filter to get the date.
Alternatively, to get them in a top wth notes and a bottom with comments, use attachment displays to get two views into one. Make your top view, then use 'Add+' where the page and block buttons are (top left) are to select a new 'attachment'. Make new view here then add the two together with 'Attachment Settings' then 'Attach to' and choose your first view. Magic!

Resources