Make teasers optional

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

Most of the features of Open Publish I really like, but one of them is causing me problems: The teasers.

I can see the advantage of having a separate, custom teaser if you are doing a magazine-style site. But for the news sites I'm working on, adding that teaser text is getting in the way. Specifically, we do a lot of posting via an iPhone app called Blogpress, that works via the BlogAPI module. The problem is, there is no way to fill out the teaser field using this method, so all of the stories we post would go up without a teaser, and that would be bad.

I would like to explore a way to make the custom teaser optional, so that field is left blank, the default will be X number of characters/words taken from the node body.

Is there an easy way to do this? Does someone want to give it a try?

The fallback I may have to take is getting rid of the custom teaser field entirely, but I want to explore options for keeping it.

Thanks.

Comments

Easy, easy. Remove the teaser

Adam S's picture

Easy, easy. Remove the teaser from the View, then remove the teaser CCK field. If you don't understand this, please read Using Drupal. http://www.usingdrupal.com/

Marine job board with Drupal 7 at http://windwardjobs.com

It's not necessary to keep

Adam S's picture

It's not necessary to keep put a teaser in the teaser field. You can configure the view to truncate the teaser and add an elipse (...) after x number of characters.

Marine job board with Drupal 7 at http://windwardjobs.com

I tried removing the content

kcaraway's picture

I tried removing the content teaser from the view and the CCK field, but now it shows this on top of my default node teaser:

< class="views-field-"> < class="field-content">

Any idea how to get rid of that? Thanks.

Does this mean that you still

Adam S's picture

Does this mean that you still have the teaser showing but with the HTML code on top? Do you have any more information? In which block on what page is this happening? I just went through some of the code to see if there were any mistakes closing a div outside of a condition statement with an opening div tag inside and couldn't find any.

Marine job board with Drupal 7 at http://windwardjobs.com

Ok. I just went and removed

Adam S's picture

Ok. I just went and removed the teaser from the view and now see what you are talking about. This is a bug.

Marine job board with Drupal 7 at http://windwardjobs.com

For what it's worth here is a

Adam S's picture

For what it's worth here is a little piece of the output code.

<a class="views-processed" href="/author/plaga">Plaga</a>&nbsp;et al.</span>
  </div>

 
  &lt; class="views-field-"&gt;
                &lt; class="field-content"&gt;
 
  </div>
  <div class="views-row views-row-23 views-row-odd">
     
  <div class="views-field-field-thumbnail-image-fid">
                <span class="field-content"><a class="views-processed" href="/article/validus-typicus-abbas-pagus-luptatum"></a><a href="/article/validus-typicus-abbas-pagus-luptatum" class="imagecache imagecache-thumbnail imagecache-linked imagecache-thumbnail_linked views-processed"><img src="/sites/default/files/imagecache/thumbnail/filefield_nC6B4K_3.jpg" alt="Refoveo ideo quis typicus bene sed. " title="Aptent velit exputo zelus. Causa refoveo interdico ludus tum tego antehabeo. " class="imagecache imagecache-thumbnail" width="100" height="49"></a></span>
  </div>

 
  <div class="views-field-created">
                <span class="field-content">April 17, 2010 10:41 PM</span>
  </div>
 
  <div class="views-field-title">
                <span class="field-content"><a class="views-processed" href="/article/validus-typicus-abbas-pagus-luptatum">Validus Typicus Abbas Pagus Luptatum</a></span>
  </div>
 
  <div class="views-field-title-1">
                <span class="field-content"><a class="views-processed" href="/author/plaga">Plaga</a>&nbsp;et al.</span>

  </div>
 
  &lt; class="views-field-"&gt;
                &lt; class="field-content"&gt;
 
  </div>

Marine job board with Drupal 7 at http://windwardjobs.com

OK, not sure what to do with

kcaraway's picture

OK, not sure what to do with that, but thanks.

You're a busy guy on here today. Thanks very much for the help. I really love OP. It's about 98 percent of what I need, and I'm working the fix the other two percent.

In the Event Views there is a

Adam S's picture

In the Event Views there is a list of fields that it shows. You need to add Content: Event date From date field to the view to see the date.

Marine job board with Drupal 7 at http://windwardjobs.com

Unfortunately I already tried

kcaraway's picture

Unfortunately I already tried that. Again, I'm seeing the date, but not the time. I don't see any settings anywhere that mention the time as part of the display.

Also, I think these last two comments belong under the discussion about the event times not showing up. Still looking for a way to fix this bug above after deleting the teaser field. Thanks again.

I'm not sure what it's doing.

Adam S's picture

I'm not sure what it's doing. Normally you would select a format to display the event. I must be overlooking something simple. I guess I could go ahead and use the theme developer module but it is buggy with the admin module. Try using the administration menu module and disable admin and use the theme developer module. It will tell you where the variables and in what files they are being acted on in the code.

I went ahead and changed the node-event.tpl.php to use $event_date_raw variable and it returns 'array' instead of a date.

Marine job board with Drupal 7 at http://windwardjobs.com

I looked inside mysql, and I

kcaraway's picture

I looked inside mysql, and I can see the time data there. I just can't figure out why it's not passing the full values out to the page.

It looks like the Variable

Adam S's picture

It looks like the Variable has been set using the Strongarm module.

Marine job board with Drupal 7 at http://windwardjobs.com

While hunting down this date

kcaraway's picture

While hunting down this date display problem, I might have found a clue to the teaser bug, at least for the event content items.

Inside the openpublish_theme/views/events, there is a file named views-view--fields--events.tpl.php that deals with how the teaser is displayed. Unfortunately, I can't seem to make it work with my limited php knowledge. Can you take a look? Thanks.

As for the date display, Firebug shows the output is "date-display-single" which is controlled by a file named date.css. But I don't see that css file anywhere in this theme. I've checked out all the other css files to no avail. Still looking...

That solves it. First you

Adam S's picture

That solves it. First you need to disable the OP IMCE configuration feature in /admin/build/modules or disable it through features. Then disable strongarm. I don't know what effects that will have with the system. You might want to go to /admin/settings/strongarm first and copy and save all the configurations into a text file just in case you need to set them manually. There is in the Devel module in the admin menu a place to edit variables. You might be able to edit varibles that have been strongarmed but I'm not about to test that to find out right not.

Marine job board with Drupal 7 at http://windwardjobs.com

Yes, that fixes the date

kcaraway's picture

Yes, that fixes the date problem nicely. Not seeing any other effects from not having those modules activated. Thanks very much.

Now the only problem I have left is the teaser. After deleting the teaser field, I'm still getting the following showing up at the top of my default node teaser: < class="views-field-"> < class="field-content">

Any ideas on how to get past this? Thanks again.

Actually, I went back and

kcaraway's picture

Actually, I went back and re-enabled those two modules (to see if that was causing another problem with images not showing) and the times show up now. Not sure what turning the modules off and on did, but it worked.

I've worked with many Drupal

kcaraway's picture

I've worked with many Drupal sites, but not with something like this that uses the Contexts module. Could this teaser error be caused by this?

I've torn this thing apart

kcaraway's picture

I've torn this thing apart six ways to Sunday, so much I've had to reinstall it three times. I've been through every theme file, and all the views options I can find, and I still can't get simple node teasers to show without having the following line print with them:

"< class="views-field-"> < class="field-content">"

Does anyone see what I'm missing here? It seems like such a simple thing. Thanks.

OpenPublish

Group organizers

Group categories

Group notifications

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