OK, I'm new here. There may well be a blindingly obvious way of doing this, or it might be a pig! However, it's a biggy for getting the site set up right, so here goes. (and apologies if may phraseology is not correct, I hope you get the drift)

A major part of the site I'm building is for a network of National Clubs. I have created a CCK content type for "club" with a lot of information in it such as contacts, meeting location, activities, website, etc. It's quite a big data type and it (seems to) works nicely.

I also have this linked into the site taxonomy so that any club posting news, results, activities, blogs, etc; can link them to one or more clubs.

The "club" content type is by default sticky, so that it appears at the top of lists. What I want to be able to do is to have this set up so that when you list the taxonomy terms, the relevant club(s) will appear at the top of that list.

However, despite trying my hardest to make the CCK content type collapse (It is all in a group that is collapsed by default but this seems to have no effect - should it?), the "club" data type in the taxonomy view takes up the entire screen or more. I want this just to show as a logo+Teaser that the user can then expand if they need to find out more about the club.

How do I set about this?

Having the CCK fields collapse seems not to work (unless I have set something dumb, entirely possible).
Do I control this via a .tpl.php file?
Is there a way I can do this with a view (I've had a go at this but ithe interface is a little forboding and I can't see how to apply this to multiple data types )

All suggestions gratefully received,

Thanks,
Gareth

P.S. I'm running Drupal 5.2 and currently have the BlueMarine theme applied (if this makes a difference to behaviours). Test site is at drupal.bkks.org.uk but it's a work in progress and I will probably have broken something totally different by the time you get to see it.

Comments

JirkaRybka’s picture

Views is certainly a good way to go, if you want to customize node-listings. Good choice.

But however, I think that it's entirely impossible to have a teaser from CCK content type - I struggled with this also on my site, and whatever I do, CCK contents always shows full node instead of a teaser.

My solution is to quit attempts of having the teasers, and go to list- or Table-views containing only just titles (plus perhaps author/submitted time and such information). This is well possible with Views, and I found it to be the only way of having CCK contents together with other nodes in a list.

Drupal really needs to improve the teaser-creating functionality... :-/

gareth_w’s picture

Thanks for this, but I was hoping to be able to include at least some teaser information on each story. Guess that's a no-no then; unless I create another content type for the whole type and force people to type in teaser information separately (But I know from Joomla experience that people do not do that :( )

Has anyone used the contemplate module for doing this? Can anyone point me to any comtemplate manuals or tutorials?

Thanks again,
Gareth

gareth_w’s picture

For anyone in a similar situation, use contemplate.

This looks a bit scary at first and has next to no documenation I can find, but simply click on the teaser section, turn it on, and delete eveything in the left-hand "template" box.

Then, Copy the contents of the RHS (Variables box) into an editor such as notepad++ (or anything that does syntax highlighting) and cut and copy these back across into the teaser area in the order you want. Default CSS classes are provided for you to format these as you want, but I insert "_teaser" into this to give yet finer control. You can also click on the fields to add them, but doing from an editor gives better searching to find what you need quicker. Also take care where you click or random fields will insert where the cursor is - I made this mistake on my first go and the rendering engine broke with an error - I'm a little annoyed that it showed my whole site path in the message (not very security focused? or is this relative to my PHP settings?) but it just broke that one item on the page - the rest was unaffected. On other CMS's that I have used the whole page rendering would have been stuffed by that.

Don't be daunted, it's well worth a look, and while you will need CSS as well it's a lot easier in the long run.

I've just set up a mediawiki on our intranet and editing that is getting addictive. Now I've started playing with CCK, Drupal is getting that way as well. Next stop is views, if I can crack that one I'm well on my way....

jodo’s picture

and as you say there is virtually no documentation of the contemplate module.
Could you post a before and after example of what you did?

thanks

solutionsphp’s picture

I'm wading through the trials and tribulations of styling teasers myself. This might prove helpful, it also touches on using ConTemplate to expose template variables:
http://jeradbitner.com/node/19

My review of David Mercer's "Drupal: Creating Blogs, Forums, Portals and Community Websites"

jodo’s picture

the jeradbitner site was down so I found the page in the google cache. very helpful.

thanks

gareth_w’s picture

as it relies on the fields you have defined in your CCK data type. I could post mine, but it would not make a lot of sense.

However, if you know some HTML then this is not hard to do. CCK/Contemplate even provides theming cues to add to your CSS file.

To make a teaser, open the teaser portion, click the box to turn it on, select everything in the LHS box and delete it. Then simply scroll down the list of fields in the RHS box and clicking on any of the highlighted links will insert them into the LHS box. Note that as far as I can tell teaser is not generated from the body - you will need to use an abridged field to display this, or find a snippet to help you. By default there is no way of showing the whole node, so I have also added this link in.

My code is now:

<div class="section_teaser">
        <div class="section_logo" style="float:left; padding:5px">
                <?php print $field_logo[0]['view']?>
        </div>
        <div class="section_teaser_intro">
      <?php print $field_area_covered[0]['view'] ?>
        </div>
<div class="section_teaser_full_link">
<a href="<?php print $base_path ?>/node/<?php print $node->nid ?>">View Full Section Details</a></div>
</div>

This shows two fields - a logo and some text showing the areas covered. There is also a link to the full article. I've played a little with the CSS div id names, and have hard coded a float in though that is just for testing and will of course move into the main CSS file later on.

Hope this gives you a little more to go on,
Gareth

JirkaRybka’s picture

Perhaps the link should be done like print l('View Full Section Details', 'node/' . $node->nid) - your example won't work with unclean URLs, and the link is not path-aliased.

gareth_w’s picture

I'll not doubt it - I'm still a newbie and that works on my system.

I do have the problem that it does not map to nodes that are named elsewhere (/north instead of /node/99) for example.

What does the "print l" function actually do then - does the l mean link?

I will look into this.

Gareth

JirkaRybka’s picture

l() is a general Drupal's function to build links, it gives something like <a href="...">...</a>, including any path-aliases, and also considering clean/unclean URL's, and the fact of moving your Drupal installation to another URL, if this happens. Also includes some security measures. So it's nice to use it, it do a lot of work for us.

gareth_w’s picture

I've atually replaced my existing code with this now, and it works great. Better yet, it preserves the node name (/North instead of /node/99) if one is set.

To anyone thinking of copying the snippet above, remember to enclose it php tags first!

Many thanks!

Gareth

chadchandler’s picture

This is a great discussion as its been very helpful.

This may seem like a stupid question, but in 3rd grade I learned there were no stupid questions :)

If you're site is 100% teasers, and the Full node just provides the " Permalink" .... 2 questions.

1.) Would this code placed in node.tpl.php create the "Permalink" ?

  <?php if ($page == 0): ?>
<p><a href="<?php print $node_url ?>" title="<?php print $title ?>">Read More...</a></p>
<?php endif; ?> 

2. How would you display a Certain CCK field on the same line, but at the end of "Read More" , "Add Comment" ?