[development] Questions about views

Roberto Bermejo Martinez roberto at robertobermejo.es
Tue Aug 26 06:41:58 UTC 2008


Ok.
This is my view:

|$view = new view;
$view->name = 'Prueba_01';
$view->description = '';
$view->tag = '';
$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' => 'Título',
    'link_to_node' => 1,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'created_year' => array(
    'id' => 'created_year',
    'table' => 'node',
    'field' => 'created_year',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'default_argument_type' => 'fixed',
    'relationship' => 'none',
    'title' => '%1',
    'default_action' => 'summary desc',
    'wildcard' => 'all values',
    'wildcard_substitution' => 'Todos',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'style_options' => array(
      'count' => 1,
      'override' => 0,
      'items_per_page' => '25',
    ),
    'style_plugin' => 'default_summary',
  ),
  'created_month' => array(
    'id' => 'created_month',
    'table' => 'node',
    'field' => 'created_month',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'default_argument_type' => 'fixed',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
    'title' => '',
    'default_action' => 'summary desc',
    'wildcard' => '',
    'wildcard_substitution' => '',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'style_options' => array(
      'count' => 1,
      'override' => 0,
      'items_per_page' => '25',
    ),
    'style_plugin' => 'default_summary',
  ),
));
$handler->override_option('access', array(
  'type' => 'role',
  'role' => array(
    '1' => 1,
    '2' => 2,
  ),
  'perm' => 'view advanced help topic',
));
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
  'type' => 'ul',
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'teaser' => 0,
  'links' => 1,
));
$handler = $view->new_display('page', 'Página', 'page_1');
$handler->override_option('path', 'prueba_01');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler = $view->new_display('block', 'Bloque', 'block_1');
$handler->override_option('arguments', array(
  'created_year' => array(
    'id' => 'created_year',
    'table' => 'node',
    'field' => 'created_year',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'default_argument_type' => 'fixed',
    'relationship' => 'none',
    'title' => '%1',
    'default_action' => 'summary desc',
    'wildcard' => 'all values',
    'wildcard_substitution' => 'Todos',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'style_options' => array(
      'count' => 1,
      'override' => 0,
      'items_per_page' => '25',
    ),
    'style_plugin' => 'default_summary',
  ),
  'created_month' => array(
    'id' => 'created_month',
    'table' => 'node',
    'field' => 'created_month',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'default_argument_type' => 'php',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
    'title' => '%2',
    'default_action' => 'summary desc',
    'wildcard' => 'all values',
    'wildcard_substitution' => 'Todos',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => 'return arg(2)',
    'validate_argument_node_type' => array(
      'page' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
    'style_options' => array(
      'count' => 1,
      'override' => 0,
      'items_per_page' => '25',
    ),
    'style_plugin' => 'default_summary',
  ),
));
$handler->override_option('block_description', 'Prueba_01');


This is the output code:

    <ul>
      <li><a href="/prueba_01/2008">2008</a>
              (2)
          </li>
      <li><a href="/prueba_01/2007">2007</a>
              (1)
          </li>
    </ul>


And this is the output which I want to get:

<ul>
      <li><a href="/prueba_01/2008">2008</a>
              (2)
          <ul>
             <li><a href="||/prueba_01/2008/08||">August</a>(1)</li>
||             <li><a href="||/prueba_01/2008/07||">July</a>(1)</li>|
|          </ul>
      </li>
      <li><a href="/prueba_01/2007">2007</a>
              (1)
          ||<ul>||
||             <li><a href="||/prueba_01/2007/07||">July</a>(1)</li>|
|          </ul>|
|      </li>
    </ul>


|Victor Kane escribió:
> You must Add a display. Select "block" and hit the Add a display
> button. Default settings will be used, but they can be overriden for
> the block.
>
> On Mon, Aug 25, 2008 at 11:22 AM, Roberto Bermejo Martinez
> <roberto at robertobermejo.es> wrote:
>   
>> Hello
>> I'm working with the version of drupal 6 with the modules and views cck
>> 2. I need some way of creating a block to me shows a tree with links to
>> the documents as the publication date. I make a page, but can not block.
>> It would enable the block to obtain the arguments of the page?
>>
>> Sorry for my English.
>>
>> Thank you very much.
>>
>>     



More information about the development mailing list