Hello,
I am new to Drupal and I know how to create static pages by typing in the page in "Create content"->"Page".
However I would like to dynamically create some pages from a database I have created and serve them through Drupal.
Ie. If I was making a song website, I would make a "SONG" table in my database with the fields "AUTO INCREMENTING UNIQUE ID","SONG NAME","BAND ID","LYRICS","STORY","FACTS" and a "BAND" table with fields "BAND ID","BAND NAME","BAND BIO", and then I would make a page with all the song names as links, and each link would link to a dynamically created page created by pulling content from the "SONG" and "BAND" tables and placing them in a template.
Anyways, what is the best method to do this? Is there a Drupal module available for something like this? If I had to write my own PHP code for this, where would I put this code?
Thanks very much,
Daniel
Comments
Sounds like ...
... your just itching to create your own node type ... the handbook pages should help you out http://drupal.org/node/71954
Like books? Check out booktribes the new (Drupal based) community for book lovers
from Computerminds
Mike,
Computerminds offer Drupal development, consulting and training
You might also want to check out CCK and Views
In Drupal 5 core now provides the base for building your own node type without writing code. CCK adds a number of field types, some in the basic package, some in "add-ons". Views allows you construct different ways of seeing your data. Note there is even a CCK field to use a view in you content.
In terms of what you want to do, most content is based on a node which provides the unique id, so in Drupal terminology you want a "song" content type. If you wish to write your own module (instead of using CCK) you will need a "song" table that is linked to the node table (using the nid). In this case you would implement (at least) the form, validate, insert, update and looad hooks. You would also probably want to implement the mene and view hooks and possibly the block hook,
how does version 5 allow you to build a node type?
I still haven't figured out how to make a dynamic page to add stories to without posting to the home page. I need to create some pages where users can add documents to a list and create sort of a document archive. The documents can be essentially the same as the default story, but without a teaser and comments. Any suggestions? I am VERY new to this, and I am trying 5.0 and 4.7.5 at the same time.
New node types and work flow in Drupal 5.0
In Drupal 5.0 the answer to both you questions is found under Administer -> Content management -> Content Types.
The resulting page is titled 'Content Types' and the second tab is 'Add content type', click that tab to add a new content type. Fill in the information and when you get to 'Default options:' make sure 'Promoted to front page' is unchecked (to keep it off the front page) and under 'Default comment setting:' select 'Disabled' so there are no comments. The only difference from what you want is that there will be a teaser if you use the body field. If you really don not waht the teaser you can chose to not use the body field and after saving the new node type using the 'Add Field' (may need CCK installed for this) tab to add a new textfield.
For any existing content type you can use the 'edit' link to change the work flow (published, promote to front page, comments, etc).
And since it sounds like this is a new site and you are new to Drupal I would recommend Drupal 5.0 over 4.7
thanks for the quick reply!
i have done all of this, and i used contemplate to make a content type without the teaser. What I can't figure out is this:
If it is published, but not proted to the front page, where does it go? How to I get that content on to a new page other than the front? I want a mostly static front page. I guess what I am asking is how do I create a new page that I can post the "stories" I have created?
Thanks a lot. I have only been working with drupal for a few days, so bear with me...
I can deal with html and css, and I have only a basic knowledge of php and mysql.
The views module would probably be a good choice
The views module can provide a page that list just the titles of your content type or the titles plus teaser. It also can do a lot more so it can be a bit intimidating when constructing a new view for the first time. But it allows you to do what you want without writing a line of code.