i am a newbie for drupal! i use cck added additional field for certain content type but i don't want use views module create page,so how can i write sql query bymyself? and where the sql query code put?thanks!

Comments

bartezz’s picture

Hi,

Several options to do so. One, and I think recommended, is to create your own custom module to do so.
Another option would be is to create a node, set the body input filter to php and execute your query there.

But why not use views? What are you trying to accomplish?

Cheers

________________
Live fast die young

anxinhuang’s picture

I have just started studying drupal so I want to know a little more about drupal.
In my course of study,Suddenly there was doubt,If I do not have views then how can i do?

Thank you very much for reply so fast!

anxinhuang’s picture

create my own custom module i can imagine!but how can i create a node! i can't imagine ,maybe more detail information for me if available.thanks

vsr’s picture

You must be logged in.

You need to activate the PHP filter module first.

You will see an option to create content on your menu of the site you are building.

Click on the node type you want to create.

On a default install you will have "Page" and "Story".

Try a "Page".

Enter your custom code in the body section. Give the page a title.

Make the input format PHP

Select "Preview" to test your code.

If it works, you can save the page.

glowform’s picture

Does some one have an example of this that they can post?

ludo1960’s picture

glowform’s picture

thanks

mtsanford’s picture

The query is the easy part. They you've got to render it (direct theming calls to ImageCache if you're using it, etc.) and tie into the Drupal page/menu system. The book "Pro Drupal Development" is a great place to learn this stuff.

glowform’s picture

the pro drupal is only for drupal 5, and the next one is for drupal 7. if they had a six I'd get it. thanks.

mtsanford’s picture

Not true. I have the d6 version (second edition) sitting right next to me.

glowform’s picture

really, i read the reviews on amazon, and they said it was only 5. I'll just have to make sure I get the 2nd edition. Thanks, that's very helpful, it looked like the type of stuff I wanted from the chapters. just ordered it. thanks again.

bartezz’s picture

________________
Live fast die young