im trying to create a grid view of all nodes on the homepage that iterates through 3 different template patterns so I can have different image开发者_开发百科cache presets for each node passed into the view. I use page-front.tpl.php for the home design and currently have a template preprocess pointing to node-front.tpl.php.
Im imagining that the only way to really accomplish this is in a template preprocess?
So Im hoping the code will give me the ability to assign different imagecache presets to each of the 3 alternating nodes in the pattern, like:
for node "1", display template pattern "1" with imagecache preset "big-image".
for node "2", display template pattern "2" with imagecache preset "tall-image".
for node "3", display template pattern "3" with imagecache preset "small-image".
for node "4", display template pattern "1" with imagecache preset "big-image".
for node "5", display template pattern "2" with imagecache preset "tall-image".
for node "6", display template pattern "3" with imagecache preset "small-image".
etc.
Any drupal experts out there care to give it a shot?
Well, getting the data and grid display is easy with Views. But changing each output to use a different imagecache preset might be tricky.
I would probably generate the view, then change the output of the row tpl for the imagecache output based on the current row for the size you want to use.
It sounds to me like like largely a views issue: that you wish to have differing imagecache presets returned by the view, determined by the node id. For this type of thing, you'd best modify the views template for the view in question ... have a look at the various templates, I could see you doing this in the fields template, but also in one of the parent templates.
精彩评论