Is there any way to place 2 views in a 2 columns page in Drupal without having to install the Panels module ?
N.B. The 2 columns layout should be used only for this page.
thanks
Without Panels or Context[http://drupal.org/project/context] modules, you got two options.
You can make the views into blocks.
You can load and render the views manually in a custom module.
You can insert views via PHP in the node of the page, and then use custom HTML/CSS to make the views occupy a column each. Check this article and discussion, for example, where the code to insert the view is the following:
<?php $view = views_get_view('viewname'); print $view->execute_display('default', $args); ?>
This will, of course, require full permissions for the node editing, but if this is just for one page, I assume you have all the needed permissions to do it once.
In Views 3 you can use "Global: View area" (Insert a view inside an area.) in header or footer of your current view
Related
I have a library page with some taxonomy topics(resource types) that are currently being filtered by some really hacky tabs that I would like to replace to do two things:
1) get new, more user friendly tabs, with the capability to be placed outside of the view yet change content inside the said view.
2) be able to have the tabs grouped together in a way I can manipulate them with css.
I am fairly new to the drupal world. What would you suggest? Thanks!
Do you use exposed filter options?
If so in the advanced tab of the view you have a option 'Exposed form in block' this way your exposed filters will be placed in a seperate block.
After saving the view you have to enable the block
How can I show multi views on single page in Drupal?
I need to show two results, (maybe you can think 2 tables, but actually 2 views) on one page.
Anyone please help me.
You can use the panels module. That will allow you to put views in different types of layout on a page. And take arguments as required.
You can do it by creating a page with your first view. For the second view you have to create a block and add it to that page.
btw: please use https://drupal.stackexchange.com/ for drupal specific questions...
As laebs suggested one way is to create block view and to add it to some region when your page is displayed.
Other way would be embedding the view from template file:
https://api.drupal.org/api/views/views.module/function/views_embed_view/7
With this function you can specify which view and which display you want to embed. You can also pass the parameters this way.
And notice that you have "embed" display type (it may be hidden by default - check view options). If you use it you'll also get those nice "edit view" links when embedding view this way.
There are two ways that I know of without using other modules:
Use the Views Header/Footer area to load another view. Just click "Add" in the Head/Footer area of the Views UI and you should see "Global: View area".
Create a page template and insert the views that you'd like to have on the page within the template using some Drupal API php:
<?php
$view = views_get_view('view_machine_name');
print $view->execute_display('default', $args);
?>
I'm using this excellent method to attach an image gallery to a node using 'Views Attach' and 'Node Reference URL' modules (amongst others): http://www.lullabot.com/articles/photo-galleries-views-attach .
It's working fine. What I'm trying to do now is to create a page of teaser items that will have an attached single image version of the gallery.
After creating a new Views attachment for the image I can do this using a new page View that uses Row style = Node, and this works (the image is displayed). However this doesn't give me the fine grain options that using Row style = fields allows.
So is it actually possible to use Row style = fields with Views AND have another View attached to it? I thought there might have been a nice 'Attached view' field to choose... :)
Edit: I guess I can use a themed version of the node teaser to remove some of the node elements I don't want to show up (tags etc.). Will try that...
Cheers,
James
Just build out the views using rows. Then you can override the view template for that particular view (ex: views-view--yourviewname--block-1.tpl.php).
Within that template you can embed any of your other views
ex: <?php print views_embed_view('viewname','block_2')?>
You can do what Hunter Frazier suggests, or you can add his PHP snippet as a PHP field to the view settings. In this way, you don't need to create a template file because the view output is considered a field of the primary view.
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)
By default for creating content a new page is opened. I want to do this inside a block. A block where there will be some fields like title body taxonomy terms and a create content button. How can I do this?
The form block module will do what you want.
You could you do the same thing in code, using hook_block to create a block. And using
drupal_get_form to render the form.
Try the Panels module.
http://drupal.org/project/panels
It will let you override and re-arrange the node add/edit form.
But, as Jeremy stated, to use this form on other pages of the site you will need to do something custom like hook_block and invoke drupal_get_form.
I agree with the answers from Jeremy and Kevin, but want to give another one.
You can use views to create the block! All you have to do is create a new view display with a block display. Add the fields you want to show, add a link field for the node/add/foo link and give it a node id filter or default argument. Here you have to choose the node id of the node to display in the block. Done!
What's nice with this solution? You can use almost every feature of views theming, drag and drop field ordering, adding new fields is cheap and no extra modules. ;)
Regards
Mike