Closed (fixed)
Project:
Teaser by Content Type
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
15 Sep 2009 at 15:24 UTC
Updated:
15 Sep 2009 at 15:44 UTC
I have code that uses node_teaser() to get a node's teaser (duh).
However this appears to only get the default teaser length, i.e. doesnt work with your module.
As the maintainer of this module, how would you suggest I integrate my module with yours? (i.e. get the correct teaser length).
I am assuming something like
if module_exists(teaserbytype) {
$node= node_load($nid);
$length = variable_get('teaser_length_' . $node['type']);
...
But I thought I'd get your input, maybe youve your own api or something.
Thanks!
Comments
Comment #1
Mike_Waters commentedOK, apparently for D6 there is a third parameter to node_teaser() (which I only discovered after examining your module ;).
This is going to be easier than I thought, sorry for the spam.
Comment #2
joachim commentedYou probably don't even need the module exists -- just check the variable and default to the global one.
Though on the other hand, a user might disable teaserbytype and then they'd expect the teaser_length_TYPE variable to be ignored.
So the way you suggest would be the way to do it, pretty much :)
Do $size = variable_get('teaser_length_'. $node->type, NULL);
and then pass $size to node_teaser. If the var isn't set, then $size is NULL, and then node_teaser uses the site-wide setting.
Comment #3
joachim commentedHeh comment collision :)
And yes, this module was a lot easier to write on D6 than on D5!