Hi,

I want to start a collaborative book and I want each book page added to the front page of the website when submitted. However, I only want the title of the book page, without any teasers or page contents. I know this is possible using the flexinode, but I'd prefer using the book module; mostly because I don't know how to create a drop-down box in the flexinode creation page that will allow users to include the page into a book at the time of submission (Although they can do it afterwards, I'd prefer the option to do it at the time of creation.)

Thus, my question is how can I remove all book page content from the front page at the time of submission?

Thanks!

Comments

register’s picture

If I could figure out how to add a flexinode submission into a book at the time of creation, then that would be okay as well. Is this possible?

Lineman-at-lineman.net’s picture

You could always edit the book module so that it appends <!--break--> to the start of all submitted content.

register’s picture

I tried appending <!--break--> to the beginning of a submission and it wouldn't work that way. If I can figure out where it should go in the book.module then I'll give it a try.

Thanks!

register’s picture

I tried guessing and it didn't work.

nevets’s picture

By modify book_content I think the following does the job

Replace

    // Extract the page body.
  $node = node_prepare($node, $teaser);

with

  // Extract the page body.
  if ( $teaser )
  {
    $node->body = "";
    $node = node_prepare($node, FALSE);
  }
  else
  {
    $node = node_prepare($node, $teaser);
  }

You could add another setting to the book module, say book_show_teaser, default to yes then change the if statement to

  if ( $teaser && variable_get("book_show_teaser", TRUE) )

this way the site administrator can chose to show teasers or not.

register’s picture

I'm not sure what I'm doing wrong, but that didn't work. The teaser is still showing on the front page.

register’s picture

// Extract the page body.
$node = node_prepare($node);

Could you just leave the teaser out altogether? I'm not much of a programmer, but this makes sense to me. Of course I could just try it and see, but I'd likely mess something else up unknowingly... ;-)

Update: I tried it and it doesn't work either.

register’s picture

Maybe it is removing the teaser and showing the entire post? The problem with this is that I don't want anything on the front page except the title of the post. I haven't tested it yet, but my guess is that's what happened.

kps’s picture

You could use excerpt.module to make teasers independently editable; I'm pretty sure they can be blank.

register’s picture

Does it have an option for excluding the teaser field altogether? I don't even want it available, because someone will surely use it if it is.

kps’s picture

No, excerpt.module always provides a box for a custom teaser.

Try this: ... okay, no attachments here ... well, save the following as 'noteaser.module' in your modules directory, enable at admin/modules, configure at admin/settings/noteaser ; as-is, no warranty, no support (well, no free support), blah blah blah...

<code>
<?php
// $Id: noteaser.module,v 1.1 2004/11/11 23:19:22 kevin Exp $

function noteaser_help($section) {
  switch ($section) {
    case 'admin/modules#description':
      $out = t('Suppress teasers.');
    case 'admin/settings/noteaser':
      $out = t('Settings for suppressing teasers.');
      break;
    default:
      $out = '';
      break;
  }
  return $out;
}

function noteaser_settings() {
  $header = array(t('node type'), t('show teaser'));
  foreach (node_list() as $type) {
    $node = new StdClass();
    $node->type = $type;
    $rows[] = array(
      node_invoke($node, 'node_name'),
      form_checkbox('', "noteaser_show_$type", 1,
                    variable_get("noteaser_show_$type", 1)),
    );
  }
  return theme('table', $header, $rows);
}

function noteaser_nodeapi(&$node, $op, $arg) {
  switch ($op) {
    case 'load':
      if (variable_get("noteaser_show_$node->type", 1) == 0) {
        $node->teaser = '';
      }
      break;
  }
  return NULL;
}

?>

eltweako’s picture

Thanks for the code.
I was already looking for something like this ......

register’s picture

It works great!

echos’s picture

This does not seem to work on 4.5.2. I ahve been trying to get a page on the front page for awhile. All I get is the teasers from each entry. I have set teaser to unlimited, I have installed noteaser.module and I ahve tryied the flexinode module. My front page stll shows only teaser of entries.