Trying to configure a new site, I'm a drupal newbie but familiar with HTML and perl (will do PHP if I have to), and "get" the general CMS paradigm. Looked all over drupal.org for info related to this, but no dice. Help!

Problem: I'd like to have a block of content that always appears at the top of the front page content section, but then lists blog and story posts underneath with latest at the top (but below the top block).

I tried creating a custom block and putting it in the content section (front-page-only display) and weighting it to -10, but the blog/story automatic listings always appear above it, anyway. Grrrr.

I'm using the default Garland theme, but don't know if this behavior is theme-related or not.

Isn't there any way to get "tombstone" content above the blog/story listings? I couldn't find a way to configure these content types to adhere to the block-weighting scheme.

Is there any workaround that anyone can think of? I just started looking at this over the weekend. On a steep time-line to get a basic site live by Monday, so I can't wait around for weeks/months to figure this out, but no budget to hire paid expertise either.

The brute-force method will be to use only the generic "page" content type (no blogs or stories) and manually create listings on the front page content block. But this is not scalable.

Any help would be most appreciated.

Thanks.

Comments

drumlin’s picture

I'm not completely sure whether that's solving your problem but it sounds like what you're looking for is "Sticky at top of lists". You can find it under "Publishing options" in article/story/blog edit mode. Just switch it on for the content you've created and voilà...

HTH,
Marco

Jeff Burnz’s picture

You can create a post and set it to sticky/promoted to front or do it in a block - yes, really.

In template.php create a new 'region', by memory with garland you'll need to declare the function also (since Garland is not doing this). phptemplate declares 5 regions by defualt - header, left, right, content and footer - but we want one more - lets call it 'contenttop'.

function garland_regions() {
  return array(
       'header' => t('header'),
       'left' => t('left sidebar'),
       'right' => t('right sidebar'),
       'contenttop' => t('content top'), //the new region
       'content' => t('content'),
       'footer' => t('footer')
  );
}

Now, in your page.tpl.php file you need to print out that region, place the following code directly above <?php print $content; ?> - which in Garland is on line 75.

<?php print $contenttop; ?>

If you only want that region on the homepage you can put it in an 'is front'... I'll leave that as reading task for you:)

Now go and create your block and you will see that you have a the new region to select from the drop list! Great! Using the block visibility settings you can set it to only display on the <front> page, or where ever.

www.sitespring.eu

Jeff Burnz’s picture

yes replying to my own post.........

of course you can always use the Mission Statement feature (/admin/settings/site-information)

that only displays on the front page and is above the teaser list in garland...

why didnt I think of that earlier, oh well....

dkdev’s picture

Thanks, this needs to lead off the "content" section under the header.

Just getting back to this, thanks for all the earlier comments, will check out those ideas too.

Addendum:

Sorry, also needs to contain an image tag and preferably without a title displaying (that's why I ended up trying a block). I think the mission can only be text?

elven’s picture

No, not necessarily.
Just change the input format to "Full HTML", then also img-tags will work.

dkdev’s picture

This sounds like the "right" way do do what I want to do, will check it out.

Thanks!

dkdev’s picture

Couldn't find:

function garland_regions()

in:

template.php

in the themes/garland/ folder. Am I looking in the wrong place? (Using v5.1)

I *do* see the place for the extra print statement in page.tpl.php.

Jeff Burnz’s picture

You have to paste that whole block of code (function garland_regions().... ) into the Garland template.php file. I normally place it just below the opening <?php tag

dkdev’s picture

Thanks, I finally realized that the default regions are defined elsewhere (didn't initially understand that PHPTemplate is located somewhere else), and the template.php overrides it all in a lump.

Got it working, thanks a ton.

coupet’s picture

Excellent solution.

----
Darly

BobLouis’s picture

Thank you jmburnz!
I had the exact same problem, and your solution works perfectly :)
Thank you for the clear explanation.

infoterror’s picture

This is a great way of creating that header block but what if one wants to automatize the process of promoting certain content to that block?

For instance, I'd like all new stories to appear with title and first image from story on header block.

I can edit this manually but how do I let drupal perform this action automatically, or how can I choose to promote a story to the header block in edit page?

laura s’s picture

There are many ways to do this. First to my mind is "panels" module, which is being actively developed and improved into yet another essential website module, to go along with views and cck. By adding nodequeue, you can define specific order of posts in various views (which are custom displays of content) ... and panels will provide you an admin gui to insert various views, blocks, posts and custom content into various css layouts.

Direct code may be more lean and elegant, but if you're not a coder, or are developing for a non-coding client, these modular solutions could potentially assemble what you need without any custom coding at all (aside from the usual theming concerns).

Hope this helps!

Laura
_____ ____ ___ __ _ _
design, snap, blog

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

dkdev’s picture

Thanks Laura,

I can code enough to get this done if I can find where the code is. :-)

I think in v5.1 the regions-definition is no longer in template.php, but if I can find where that code is (or where regions are defined for the garland theme, however it is accomplished) I can tweak it as noted above.

That said, I'd look into using the panels module, except it's not one of the core set, I guess (doesn't show up in my admin list). I haven't installed any additional modules yet (is there a preferred term for modules not in the core set? maybe "external" modules or something like that?), and someone else did the original install.

I'll need to install at least one more, though, as I want to set up a petition (may use the new "SignIt" that someone pointed me to), so I may as well install another too.

laura s’s picture

You will find a lot of interesting stuff in the contributed modules. Some are iffy, but many are excellent and are must-haves for us in just about any installation. You might also consider views and cck.

Laura
_____ ____ ___ __ _ _
design, snap, blog

_____ ____ ___ __ _ _
Laura Scott :: design » blog » tweet

maxlobovsky’s picture

I was struggling with the exact same need and I found the views module to be exactly what I needed. After installing it, go to "views" in the administration menu and click "add" next to the "frontpage" view. The "frontpage" view is identical to the default frontpage, but it is far more configurable. Add a header to this view and put whatever html you want there. Save this and then go to "site information" and change the default front page to "frontpage".