D7.15 advice Context,Views, Custom Content Types, Paths

Events happening in the community are now at Drupal community events on www.drupal.org.
mobcdi's picture

I am hoping the Irish drupal community might be able to point me down the right track before I wander too far down the wrong way of doing things.

I've created a large (many fields) content type and used view's page display to create custom pages to show select fields on separate pages.

I'm also using context to configure what blocks and in which location they should be displayed when those view pages are requested because the theme I'm using currently works that way.
I use the contextual filter: Provide default value, Content ID from url to get the particular node id I wish to display. The number of nodes won't be large and my plan is to create a custom menu for each node to be displayed along with a custom context for each node to define the layout of that node.

Where I looking for advise in is a few areas
1: Whats the best way to design the views so they are suitable for each node of type custom content but still have custom paths? I particularly need guidance on how to pass the node ID but have user friendly url's/paths
2: Can I use View field tokens in the custom path as I have a field I would like to include if its possible?
3: I am considering creating some blocks via views to separate some of the content type fields away from the custom page view so I have more control over their placement and formatting using content but am wondering if blocks are the best way to do it and if so how do I make sure the blocks have the same custom content node id as the page view. (the context I create will also use other blocks from drupal so that might affect the situation)
4: This is probably the easiest bit. Do I just modify the custom content type display settings to hide all the fields so the only way to view the node contents is via my custom views or is there a better way to override the node view?

Michael

Comments

Display Suite

markconroy's picture

Without knowing the makeup of your site, or why you need so many fields for a 4 page site, etc, I have a feeling that instead of views and context,Display Suite and/or Panels might suit your needs better.

As to your Question 4)
One way to override the node is to set it as "unpublished" and then use views to take the info from it that you want, so it's displayed as you wish, but is node show at yoursite.com/node/x (though, this can also be achieved with Display Suite.

Sorry I should have been

mobcdi's picture

Sorry I should have been clearer, the site will have between 20 and 30 nodes made up of 2 or more custom content types with a few basic pages for good measure.

I decided on multiple page views of the same custom content type to separate out and group similar fields into pages if you take the idea of a house content type of an example i would have separate view pages for location, room details, facilities and ideally I would like the paths/url to be unique to each node e.g. site.org/detached/ardrath/location would show location fields for node 13 while site.org/cottage/dunraven/facilities would show what heating system was used.

Panels does look interesting but I have an existing responsive theme I would like to re-use which uses css to define the region dimensions, is it possible to automatically convert a theme to a panels layout. enabling panels seems to restrict content placement to just 1 region of the theme but that region is laid out according to the layout design I choose in panels.

Do non panel themes play well when panels are added into the mix?

paths is fine

markconroy's picture

paths will be fine in views, you can specify whatever path you want, and/or create them dynamically from tokens/replacement patterns.

I reckon every theme should be able to use panels, even responsive ones. See here:
http://drupal.stackexchange.com/questions/17735/can-we-use-panels-for-re...

After that, there are so many variables at play in your questions, that it would be very hard to give any answer without seeing the project in more depth.

Perhaps someone else might chip in here.

Mark is on the right

alanburke's picture

Mark is on the right track.
Using views is the way you are currently doing is a bit awkward.
It is really for listing a number if items in a particular way, not for alternate displays of a single item.

I think using Panels for alternate layouts is a better bet,
You can have alternate displays for the same node, depending on different 'contexts'.

Or another module, Display suite might be another alternative.

D7.15 advice Context

mobcdi's picture

So I'll forget about views for anything other than lists of nodes.

Is the context in panels completely unrelated to the actual context module (enabled in the julio distro I'm using)?

Are there any tools or resources you would recommend that would aid in converting a theme to better play with panels as the 1 based off hexagon http://drupal.org/project/hexagon doesn't allow panes to be located in the left side and only really recognises the right side as an area that can be split into panels

Would panalizer help or further complicate the whole thing?

Zen or Omega

markconroy's picture

Your best bet for a starting theme would probably be Zen (around for ages, used by thousands of sites) or Omega (around since Drupal 7 - lots of documentation, very powerful, can use panels in responsive themes, as per above).

Another useful module

alanburke's picture

This cropped up today.
http://drupal.org/project/view_mode_page
described at http://atendesigngroup.com/blog/view-mode-page-module
Very useful for the OPs needs

It does look very interesting

mobcdi's picture

It does look very interesting I'll check it out, thanks for keeping my query in mind

Im going to throw my 6 pence

somes's picture

Im going to throw my 6 pence in

As Alan says its awkward but still possible you have to understand the hierarchical structure of a page within drupal – Im hoping your using drupal 7, Iv been doing a site the last few weeks that needed a lot of subtle theming using views related to the path arguments

I would probably attack the problem some what like this create the relevant paths within your views and make sure that the arg(0) is different as this will determine state of your application - then you can filter the view by content type(maybe use arguments) and relate these to the path

This can be used to theme you page so that you can display particular blocks or call a theming template based on the arg(0) in the theme_preprocess_page

Depending on if you want to view fields based on nodes as list or tables – if displaying nodes you can use something like this

<?php
function theme_preprocess_views_view_unformatted(&$vars) {
              
$view = $vars['view'];
//dsm($view->result);
$viewout ='';

if(isset(
$view->result)){

if (
$view->name==' archivearticles'){
// do something flash here

$vars['viewout'] = ‘hello world’;
}
}

}
?>

then create a tpl.php file called views-view-unformatted--archivearticles.tpl.php
and insert

<?php
print ($viewout);
?>

If you are displaying tables I would stick with the default and either use stacking of the fields with PHP code field to achieve what you want messing with the table is tricky but it can be done using the methods I mentioned above. Remember the order in what fields are call is important and some of them can be hidden from the user

Its hard to give an example but look at the api and info on theme_preprocess_views_view_unformatted(&$vars)

Hope that helps – clear as mud !!!!
M

Ireland

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: