I would like to be able for my view to have the URL of /blog (the blog module seems to occupy that space). I'm not sure where views comes into the stack and if it's able to override that when i assign my path value for my view. If i create a path of /blog is Drupal going to ignore that and render the default /blog presentation?

Comments

rockitdev’s picture

Status: Active » Closed (fixed)

here's the behaviour i am noticing.

the /blog path seems to render the my view the way i expect it to.

however, if i include /blog/taxonomyterm it reverts back to the default rendering of a blog. here is my view.

$view = new view;
$view->name = 'Blog';
$view->description = 'A Listing of all blog posts in chronological order';
$view->tag = 'blogs';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'title' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'relationship' => 'none',
  ),
  'teaser' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '250',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'exclude' => 0,
    'id' => 'teaser',
    'table' => 'node_revisions',
    'field' => 'teaser',
    'relationship' => 'none',
  ),
  'comment_count' => array(
    'label' => 'Comments',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'set_precision' => FALSE,
    'precision' => 0,
    'decimal' => '.',
    'separator' => ',',
    'prefix' => '',
    'suffix' => '',
    'exclude' => 0,
    'id' => 'comment_count',
    'table' => 'node_comment_statistics',
    'field' => 'comment_count',
    'relationship' => 'none',
  ),
  'view_node' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'text' => 'Continue Reading',
    'exclude' => 0,
    'id' => 'view_node',
    'table' => 'node',
    'field' => 'view_node',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'name' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '%1',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'taxonomy_term',
    'validate_fail' => 'not found',
    'glossary' => 0,
    'limit' => '0',
    'case' => 'none',
    'path_case' => 'none',
    'transform_dash' => 0,
    'add_table' => 0,
    'require_value' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'blog' => 0,
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 1,
    ),
    'validate_argument_type' => 'name',
    'user_argument_type' => '',
    'restrict_user_roles' => 0,
    'user_roles' => array(),
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status' => array(
    'operator' => '=',
    'value' => '1',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status',
    'table' => 'node',
    'field' => 'status',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'blog' => 'blog',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('title', 'Blog');
$handler->override_option('use_pager', '1');
$handler->override_option('use_more', 0);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'blog');
$handler->override_option('menu', array(
  'type' => 'normal',
  'title' => 'Blogs',
  'description' => '',
  'weight' => '0',
  'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));

rockitdev’s picture

Status: Closed (fixed) » Active
merlinofchaos’s picture

Please don't edit comments. I receive emails when the comments are generated, and not when they are edited. When I saw you close this issue and then reactivate it without comment I was very confused.

For overriding blog, I believe you need to override 'blog' and 'blog/%' independently. You can use 2 page displays with the same settings to achieve this result. This is from memory, but the issue is because Drupal's menu system can be quite tricky when it comes to overrides.

rockitdev’s picture

Sorry dude.

I gave it a shot with 2 displays, but still seem to get the desired result when i pass a term as an argument. it's not that big of a deal that it won't work... thanks for getting back to me.

frankcarey’s picture

same issue here. I figured this would have been super easy, but menu system strikes again :) I'm trying 'blog/%' as the path for the view. Any ideas why this wouldn't work?

frankcarey’s picture

wait... forgot to hit save ...ugg 2am :) Please note that this IS working for me now, but only "blog/%" not "/blog". I'll try the double display solution mOFc suggested.

Jumoke’s picture

I created a VIEW using blogs/% as display. The argument is %username.
When i go to blogs/% i still see the regular system blog. What am i doing wrong?

dalin’s picture

Status: Active » Closed (fixed)

Works as @merlinofchaos suggests: create one View with two identical displays, the URL for one is
blog
, the URL for the second one is
blog/%

jpromeo’s picture

I am having the same issue with no resolution. I have one view with 2 page displays - one with no arguments (/blog) and a second for date arguments (/blog/%1/%2). The view seems to be overriding the system for /blog as I can change the pagination and see the correct result but when I try to add an argument (/blog/2011), I get a 'page not found'.

Any insights would be appreciated.

nateman332’s picture

Version: 6.x-2.3 » 6.x-2.16
Status: Closed (fixed) » Active

This isn't working for me.
I'm doing as @merlinofchaos suggested (two identical pages, one with path "blogs/%" and the other with "blogs") but I'm still getting the default display.

An example is http://www.alberni.ca/blogs/comfort-zone
This is what the page should look like: http://www.alberni.ca/blogs/all

Help!

VM’s picture

are you sure you saved the views?

as an aside, in today's environment, I'd think that a future proof idea is to bypass the blog.module and create your own blog content type using. then generate your lists with views and taxonomy? It's how I've deal with blogs since D6 and IIRC the blog module is deprecated in D8. If you've building a new site, one should really consider D7 instead of D6 at this point since D6 won't be supported when D8 is released.

nateman332’s picture

Although this isn't fixed for me, I changed the URL alias for user blogs and now it's working fine (and yes, I saved the view). Could it be that views cannot override URL aliases? (the % in my view represents a username not a user ID)

gdesmarais’s picture

For what it's worth, this post explained it to me:

http://drupal.stackexchange.com/questions/4413/how-to-override-individua...

You need to override the internal path of blog/uid (blog/% as the path on your virew page).

blogs/[username] is the path alias; the internal path is blog/[uid]. Change your view to use the internal path blog/*.

MustangGB’s picture

Issue summary: View changes
Status: Active » Closed (outdated)