Geeks and God Podcast

(206)984-3694geeksandgod@gmail.comfeeds.feedburner.com/geeksandgod
login | register

CCK and Views

Okay well I've started on my drupal site. I downloaded and installed CCK and activated views as well. I made my first type of content called "Welcome Message" which is supposed to be a static message that will display on the front page.

Now, I'm trying to figure out how in the world should I define this view (or if I'm supposed to even mess with views), and then how I can put a snippit php of code in my page-front.tpl.php file, nested between some divs to display it in a specific spot on my page and to style it. But I haven't got a clue and the more things I try, the more I just mess up the look of the site. I'm feelin like I should just go back to my old static way of building pages! Help! (and thanks ahead of time)

CCK & Views Explained

Hey radner,

Welcome to Drupal.

I would not use CCK to define a welcome message. Instead, create a "Block" (admin/build/block/add) and limit it's display to the front page (under the "Page specific visibility settings" dropdown), save it, go to your list (admin/build/block) and place it in the appropriate region.

CCK is used to define custom content types. I’m currently defining an "Event" that will ask the user for title, place, date, contact info, etc. All of this info could be entered into "Stories" or "Pages," however CCK lets Views do its magic.

Views is used to sort content. In my example, because event date is defined through CCK, I can use Views to display my events chronologically (regardless of the order they are entered.) However, Drupal would be unable to sort the events by event date if they had been entered as "Stories."

Since you're familiar with html, tpl.php files will look very familiar. By adding content directly into your tpl.php, it will appear every time that template is called. Content entered into the page templates will display just fine but is not editable through the Drupal interface. It is fairly common to include all of your content in nodes or blocks but place a "Created by" link in the page.tpl file.

Hope this helps, feel free to ask if this does not make sense. Drupal can have a challenging learning curve, but it's worth every minute.

Blessings!

-NP

Thanks NP. Quick question. I

Thanks NP. Quick question. I really don't have any regions set. Instead I'm coding this as close as possible to what I normally do. That said, is there a way to use some php to place a block wherever I want in my css divs on my main site instead of limited myself to some regions?

I've got some pretty specific areas because my theme is very stylistic. I've got background images for some divs that look like "post-it" notes and it'd just be easier to embed some php code that calls and displays the block in my div that has the post-it note as its background. Otherwise the content wont display exactly where I want and it will look messed up.

Oh wait - got it figured

Oh wait - got it figured out! Woohoo! I noticed my custom theme did not have a template.php file. And I realize I probably should use regions as it will make life much easier so I just went into my template.php file and created a new region specifically for my welcome message. Getting my block to display in the region was a snap after that. With a little css, I've got things looking good so far!

Now I just have to start coding my custom blog page, news page, announcements pages and staff pages. I'm getting there, and I think I'll have a very nice looking site when I finish. I'll have to post the link to the site once I get it up and running. Thanks again and God bless!

Part of the SAP Network