After 2 days of searching and testing modules for our website, today I stumbled upon this awesome module that does exactly what I'm looking for: give freedom to the content editor to MANUALLY specify which and where pieces of content will display in a 3-column layout of the homepage.
However I'm having a hard time trying to Add or Modify the rendering mode for articles output. What I'm trying to achieve is to simply render only 2 elements from the node:
Node Image
Node Summary/Trimmed text (which will link to the original node).
My very limited php skills aren't helping me much, so any help will be greatly appreciated.
Regards
Comment | File | Size | Author |
---|---|---|---|
#1 | sketch.png | 7.5 KB | Tunox |
Comments
Comment #1
Tunox CreditAttribution: Tunox commentedLittle progress by digging a little further using as a clue the if statement example given in this module description.
By adding to node.tpl.php :
I disabled the display for the pesky user profile picture, and the submit date, but having a tough time finding where to trim the body text and how to change the order of the fields from:
Title
|
Node image
|
Text
to:
Node image
|
Title
|
Text
Basically trying to achieve this:
Any tips?
Comment #2
Tunox CreditAttribution: Tunox commentedSome more progress. We get so lost on searching for tiny details that basic Drupal idiosyncrasies get out of our brain. It was the case with View Mode which is a Drupal thing and responsible for handling the size of the trimmed text I wanted to achieve. On a side note maybe in the project page a link towards what View modes are and how you can add/modify them can be a helpful reminder to future users. For example:
Drupal 7 custom node view modes
Adding View Modes with Entity View Modes module
So I'm almost near to the goal of achieving the desired output except for the node Title that I want it below the image. Since in Drupal we can't rearrange the order of body fields natively, I have to modify node.tpl.php and arrange the markup for $title and $content variables. The issue with this scenario is that it will affect also the full node view which I don't want. To avoid it I have to properly implement
Although a simple if else statement this goes beyond my skills set for now, so some code help to properly integrate the $node->nodesinblock exception will be really useful.
node.tpl.php as it is now
Comment #3
Tunox CreditAttribution: Tunox commentedok I hacked my way to achieve the desired output. Here are the steps in case any Nodes In Block future user wants to achieve the same output as in the image in #2
1. In the theme's template.php file add :
2. Make a copy of your theme's node.tpl.php and rename it in node--front.tpl.php or if your theme doesn't have any fetch the one from /modules/node folder.
Basically this will allow you to modify the output on the nodes of your homepage independently from your regular full node view. In my case I took out everything except for the title and content variables.
3. In #2 I still had issues with getting the node title between the image and the text. That is because by default $content renders everything there is displayed in the View Mode of the concerned content type (admin/structure/types/manage/article/display/teaser). To separate image from content body (or any other field for that matter) I rendered them separately like this:
print render($content['field_image']);
and
print render($content['body']);
I place the title variable(s) between the two and all is good :)
Obviously you can achieve all of this with Views, but in my case that wasn't an option as the grid output of the views didn't give to the content editor the freedom on manually ordering the node teaser.
For the Drupal pros out there all of this is natural like breathing air, for the rest of us designers and site builders installing a module and learn how it bend it it is critical so one of these days I'll take the time and do a screencast about Nodes in Block.
Comment #4
Tunox CreditAttribution: Tunox commentedclosed