I am brand new to Drupal and trying to see if I can use it to create a layout I want. I basically want to create multiple sub-sites (Debian Info, PHP Info, Personal Info, etc) and on the index page create blocks that show the latest new content for each category. Then you can click on a single content item and get a full site with its own blocks (so a block of the latest debian articles will show only when on the debian sub-site).

Is there a way to create these blocks on the index and pull in the last 3-4 content items?

If I'm not clear on what I'm talking about please let me know and I can sketch up a layout.

Thanks for the help.

Comments

kbahey’s picture

In a future release, Drupal will be able to place blocks anywhere, not only on left sidebar and right sidebars.

For now, you can do one of several approaches:

1. Create a node with type PHP and insert in it any code you want that pulls data off the database in anyway. Then make this node your home page.

2. Use the front page module and do something similar (not sure if it supports PHP or not. Probably it does)

3. Use a phptemplate based theme and customize the page.tpl.php to do what you want.

More than one way to skin a cat in Drupal.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

leblank@cyberocity.com’s picture

... that will work. You can create a new block and paste in code to display what you want, as a link to another url, for instance. Since you can turn blocks on and off as you please your new block will look just like the others but with custom content.

As far as getting the info I'd see if it is in the variables already and call it or ... if not copy a db query that is essentially similar and change the table names or whatever to get the info.

Looks like for diff sites you just wanna hand code links and show them in a block, maybe have the last 3-4 items from that site as teasers ... ?
---------------
LeBlank

deuce868’s picture

Yea kind of like teasers I guess. I've just been trying to run a personal site that includes content from my adventures in things like running my debian servers, PHP programming, but also include things a personal site needs like my wedding info. I've been trying to find a way to separate the content into little sub-sites that way people don't have to wade through all the garbage they aren't interested in and I can have a bit more freedom customizing each sub-site for what it's really for.

I've been thinking about setting up 4 individual sites and then just creating some kind of custom index that will tie them together, but it just seems a like a lot of duplication. I guess I'll work on getting familiar with drupal and going from there. One of the reasons I'm drawn to it is the fact that I can write custom php blocks.

Dublin Drupaller’s picture

Hey Deuce...

Great minds think alike...!

I'm trying to do the exact same thing and have started a PHP snippets thread here:

http://drupal.org/node/20630

I'm struggling a little bit..as I don't know php and sql that well..but I'm hoping the more experienced drupallers will help out by pasting the odd snippet in there thickos like me can tweak to suit...

If you do come up with any neat php snippets...please paste them on that thread if you get a chance.

I'm convinced that using out-of-the-box features from drupal and setting up PHP pages is much more efficient and flexible than installing and hacking a module to do something or having to start developing overrides.

The way I'm going about it is to use phptemplate and it's excellent layout capabilities and using PHP snippets to generate dynamic page content....

That way, I don't have to worry when upgrading..i.e. which module did I hack? etc.

Hope that is of use..

Dub

DUBLIN DRUPALLER
___________________________________________________
A drupal user by chance and a dubliner by sheer luck.
Using Drupal to help build Artist & Band web communities.

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate