By priceline on
I want to display the first 2 lines of content, and provide a link for rest of the content.
I would like to display like teasors for the last two published content in the home page. How can I do that? You can check my page at www.fortunesindia.com.
Here is view I exported.
$view = new view;
$view->name = 'Latestnews_new';
$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(
'field_news_on_value' => 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,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'long',
'multiple' => array(
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'group' => TRUE,
),
'repeat' => array(
'show_repeat_rule' => '',
),
'fromto' => array(
'fromto' => 'both',
),
'exclude' => 0,
'id' => 'field_news_on_value',
'table' => 'node_data_field_news_on',
'field' => 'field_news_on_value',
'relationship' => 'none',
),
'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,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'body' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 1,
'max_length' => '100',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'field_news_on_value' => array(
'order' => 'ASC',
'delta' => -1,
'id' => 'field_news_on_value',
'table' => 'node_data_field_news_on',
'field' => 'field_news_on_value',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'latestnews' => 'latestnews',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('title', 'Latest News');
$handler->override_option('items_per_page', 2);
$handler->override_option('use_more', 1);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
'columns' => '1',
'alignment' => 'horizontal',
));
$handler->override_option('row_options', array(
'inline' => array(),
'separator' => '',
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('fields', array(
'field_news_on_value' => 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,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'long',
'multiple' => array(
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'group' => TRUE,
),
'repeat' => array(
'show_repeat_rule' => '',
),
'fromto' => array(
'fromto' => 'both',
),
'exclude' => 0,
'id' => 'field_news_on_value',
'table' => 'node_data_field_news_on',
'field' => 'field_news_on_value',
'relationship' => 'none',
),
'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,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'body' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 1,
'max_length' => '80',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'field_news_on_value' => array(
'order' => 'DESC',
'delta' => -1,
'id' => 'field_news_on_value',
'table' => 'node_data_field_news_on',
'field' => 'field_news_on_value',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
));
$handler->override_option('distinct', 1);
$handler->override_option('block_description', 'LatestNews Block');
$handler->override_option('block_caching', -1);
Comments
Duplicate posting
Duplicate of http://drupal.org/node/429572.
Please don't post duplicates.
Actaully they asked me to do
Actaully they asked me to do in new post:
here is the message below:(from that post)
VeryMisunderstood - May 3, 2009 - 10:17
In future it helps to make your requests clear to avoid confusion.
I believe the more link is for the entire view, not specific pieces of content. ex: the more link shows after there is more content than can be shown in your view settings. In this case, the more link would show after the 3rd piece of content is pulled as your view is set to 2.
Please describe exactly how your view is set up.
It may help to export your view, put it on pastebin.com or drupalbin.com and link to that here. Maybe someone going over your view can take a look. You have some specifics there I'm not sure how they can be handled.
specifically: "I want to display the first 2 lines of content, and provide a link for rest of the content."
how to add "read more" link at the end of teaser..
Looks like you didn't understand what I asked,
my request is : how to add "read more" link at the end of teaser..
_
Seems like misunderstanding is going around-- I see nothing in the other thread recommending you start a new thread for the same topic. When people ask for additional info and/or code to be posted they mean in the current thread not a new one, lol.
In any case, though "2 lines" is meaningless relative to web content, you can use the http://drupal.org/project/ed_readmore module to move the "read more" link to end of the teaser. If you need to change the size of the teaser, you do that at admin/content/node-settings.