Hi,

I recall reading a post from some-one who has a php snippet that would change the length of all posts automatically from say 800 to 600 without going in and having to edit the node for it to take affect. I cannot find this post, can anyone point me to it if they know of this method.
thanks - renaee.

Comments

jwilde’s picture

Hi,

Check out yoursite.com/admin/settings/node. "Length of trimmed posts:
The maximum number of characters used in the trimmed version of a post. Drupal will use this setting to determine at which offset long posts should be trimmed. The trimmed version of a post is typically used as a teaser when displaying the post on the main page, in XML feeds, etc. To disable teasers, set to 'Unlimited'. Note that this setting will only affect new or updated content and will not affect existing teasers."

Jim

Renzy’s picture

Thanks Jim - I am aware of how to change the settings, but given I have around 50 or 60 posts that I wanted to change the teaser length for, I was after a method of changing them all without having to go in and edit every single post to set it to the new length. I posted the first message cause I recall someone having a technique to just that (which I couldn't find again in the forum - should have bookmarked it!). But since then I have gone in and manually reset all my story lengths to a new shorter teaser length.

cheers - Renaee.

choc full of drupally goodness...

drupal777’s picture

I'm a bit confused. Are you saying that you have 50 or 60 different "content types"? If not, then the solution already offered will impact all 50 of your posts at the same time. You shouldn't need to edit each one individually.

But while we are on the subject, if you want to take control of the teaser, remember that you can insert: <!--break-->
where you want the teaser to break.

Renzy’s picture

hi again,

I have just one content type 'story' which I used the localization setting to change the name of it to 'review'.

It is only possible to change the teaser lengths of 'new' posts, by changing the length in admin>setting>>posts.

This will not affect any existing posts. The only way to make the teaser length shorter is to go in and press EDIT (you don't antually have to change anything) and next time you view that post, it will have the shorter teaser length.

Hence my request for a way to dynamically change the teaser length on all existing posts. Have tried the break method, but this would still involve going in and editing (inserting break) into all my old posts.

cheers - renaee.

choc full of drupally goodness...

movie-reviews.com.au

drupal777’s picture

I was thinking that re-saving isn't the same as editing. You are saying that merely re-saving is the same as editing. I think your definition is what people think of.

I would guess that there are a lot of people that re-set the teaser length and would like it to re-apply. Maybe I'll file an issue. The code can't really be that hard:

Select a content type
Select a teaser length
(the above is available automatically if this code is appended to the existing code which now sets the teaser length and is only required if this code is being written to execute from a different location)
For each row in database that matches content type node:
.. check teaser length
....if greater than new teaser length, reduce it
....if less than new teaser length, grab proper length from body, but stop if

appears

Maybe if I get an itch I'll give it a whirl.

Renzy’s picture

yeah - I am understood - makes me realise that you have to really spell out clearly what you mean in these forums. Given that no-one else has piped in and mentioned an existing method for doing this, maybe it is not currently possible and filing an issue would be good.

I will keep an eye out in the issues forum to see if you do. It makes sense your basic program statement - a php for statement to test the length followed by an if/else statement would do the trick I guess.

thanks for your persistence with this one! - R.

choc full of drupally goodness...

movie-reviews.com.au

samdeskin’s picture

HI,

I am trying to disable the teasers (trimmed posts) that appear in the content section when I press a menu item.

By setting the Length of trimmed posts to Unlimited - it seems to make the teasers the entire text. But admin/settings/node says that 'Unlimited' is supposed to disable teasers.

What am I doing wrong? ... I just want to disable the teasers on pages like this one:

http://www.finduslaw.com/taxonomy/term/6/9

So that I will have a list of the pages and no teasers.

Please advise.

samdeskin’s picture

Use the excerpt module - it works great! You can see what I have done with it here:

http://finduslaw.com/taxonomy_menu/8

sam

the_therapist’s picture

You are looking for something that loops through every node item of a particular content type in the DB and sets the teaser length to whatever you specify. I am looking for this to.

I will take a crack at this and get back to you, but hopefully someone will beat me to it. I thought it would be an easy foreach loop, but it looks like it will need to call up some Drupal functions (i.e., the same one used when the content item is re-saved to create the new teaser).

szy’s picture

The solution came here:

-> http://drupal.org/node/142544

Szy.

gpk’s picture

Or there is a little handy module to do it for you:

http://drupal.org/project/retease

gpk
----
www.alexoria.co.uk

geshan’s picture

Hope this can help you, click here
Geshan

Basic Drupal HOw to