By coplan on
Drupal 4.7-beta3. I'm using flexinode on my site for movie/book reviews. I have a couple of custom fields: Director, Writer and Body. I currently have the teaser length set to 1400 characters in the "post" settings for the site. But whenever I update or create new content, I'm getting far less than that. It doesn't seem to matter what I set the teaser length for, it seems to cut-off at the same position every time. Showing the Director and Writer fields in the teaser has no impact.
How can I lengthen the length of the teaser for flexinode content? I'd like at least 7-10 lines of "body" text on my front page.
Comments
Make a feature request
I think this might have to be a flexinode feature request, since the node body is not "normal," it won't return a normal teaser like you expect.
The only way I've found to do what you want it by making a custom node template in PHPTemplate. (http://drupal.org/node/23828)
For flexinode teasers, instead of printing $content, I end up printing something like $node->flexinode_3, or even a substr of that variable.
See http://drupal.org/node/31646 for details.
--
http://ken.blufftontoday.com/
Search first, ask questions later.
Ahhh...
This helped with part of it. But once I discovered that I could theme a specific node-type (thanks, btw), I found that I was able to create a specific feel for my nodes. But my text-area fields didn't work. Fortunatley, I discovered another fun document: http://drupal.org/node/45491
Except that since I"m using drupal 4.7.x, check_output() function has now been renamed to check_markup().
So now I'm on the right path. Now I'm going to experiment with truncating for teasers..
-- Coplan
New Problem
It seems that when I theme the flexinode type, anonymous users can no longer see the review. I just get "N/A", and nothing else.
-- Coplan
quick one..
Hi Coplan,
Please note that I'm in the process of developing a new PHPTEMPLATE based theme called "Drupalicious" and a snippet to trim a textfield to a certain amount of words was in my goody bag.
I have posted it here: http://drupal.org/node/46391
A step by step on how to use it is included.
useful if you're using a phptemplate based theme and it's a "recyclable snippet", i.e. you can use it repeatedly for different layout files.
For your flexinodes..if the flexinode text field you wanted to trim was called
$node->flexinode_9the snippet would look like this (where 20 is the number of words you would like to trim the text to):Click through to the handbook page for a step by step on how to get the drupalicious_summarise function in your theme.
I hope that helps..
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
great snippet
That's a great snippet. You recommended putting the snippet in the template.php file. I don't have one...where should that go? In the theme directory?
For now, I have the snippet directly in the node template that I am using. But I intend to use it on other node-types in the future.
-- Coplan
create one..
If a template.php file doesn't exist in your active theme folder, for most themes there are none by default, create one using a text editor.
Once the
drupalicious_summarisefunction found here is in your template.php file, you can use it in all your custom-layout.tpl.php filesThe way it works is the PHPTEMPLATE looks in the active theme folder to see if there is a template.php file and if there is it loads it up. Then it loads up your .tpl.php files.
You can add other functions or snippets into your template.php file and it gives you incredible control over layout..i.e. you can override all themable functions in Drupal by using snippets in the template.php file.
As an example, if you wanted to override the default layout of user list pages (when you go to www.example.com/profile), you add the following snippet to your template.php file: http://drupal.org/node/44481
I hope that makes sense. the magic of using template.php file in this way is that you're not touching the modules.
Before I discovered how to do this, I used to sometimes hack a module just to get something looking a certain way. That causes a huge headache when upgrading..trying to remember which module I hacked and where. It also increases the risk of breaking the site..so it's well worth knowing about the "magic of template.php" with phptemplate based themes.
That's a bit long winded, but, worth mentioning..I think.
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Good tip. Thanks.
Okay, that template.php file is something I wasn't at all aware of. Now that I know that...I am already thinking of good applications for that.
Thank you very much for your help. My flexinodes never looked better.
-- Coplan
cool..
Hi Coplan,
You're welcome re: the heads up about template.php.
If you have the time, can you add a book page to the PHPTEMPLATE section with your flexinode snippet?
I'm piecing that section together over time, but, I'm also trying to encourage other Drupallers to share their theme snippet gems so we can all benefit.
I've created a simple 1,2,3 on how to add your own snippet to the handbook which will only take a minute or two to copy and edit with your own snippet.
If not..just paste it up here as a response, with a brief description of what the snippet does and I or someone else will add it to the handbook.
cheers
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Test for node-preview?
Is there a test that I have to run for a node-preview? For now, I was basically testing if ($page == 0). If test returned true, I would trim using your snippet. If not, it showed the full page. What I've found, however, is that the preview will only show the trimmed text.
My first thought was to reverse my logic and perform a trim only if (page != 0). But I am worried that there might be other repercussions that I havn't thought about. An ideal solution would be to insert a test in my template to see if it was a preview. And then I could show that differently than any other standard node.
Any help is greatly appreciated.
-- Coplan
Bug report filed
There has been a bug report filed for this flexinode 4.7 teaser problem. If anyone has a chance to look at the code and submit a patch that would be super cool.