Hi,

I am looking at writing a couple of custom nodes that retrieve entries from the database to display on one node:

- the current month's articles

And on another:

- previous articles from previous months (aka archives)

My logic for the first node will be:

Select type, title, nid, created from node where type equals 'story'
Get the timestamp from the server

If the present month matches the month of the article and the year
Display it
Else
Do not display it

My logic for the second node will be:

Select type, title, nid, created from node where type equals 'story'
Get the timestamp from the server

If the year and or the month of the article is dated before the current timestamp
Display it
Else
Do not display it

Is this the most efficient way to do it?

Is there an existing module and/or code that does this?

Thanks!

Sarah

Comments

nevets’s picture

The views module should let you do what you want without the need to write code.

To help you out I am goiing to point out while your basic logic would work it does not take into account how SQL queries work, When you want to query only a subset of data in SQL you use the WHERE clause, with the views module these are called filters. There is even a The simple monthly archive that you can start with (you would do a views import).

thiruppathy’s picture

hi i am new for drupal... i need to select submitted data from existing data bases.. by following your answer i installed view module. i don't know next details to proceed.. so pl give details about view module..

nevets’s picture

In Drupal 5 views is focused on pulling node related data and will not pull data from just any table. With views 2 in Drupal 6 you can do this but you would need a module that described the tables for views.

thiruppathy’s picture

but i need to search particular data from webform submitted data.. without sql query is possible to report data by particular field ... i need any module support this feature...

markabur’s picture

http://drupal.org/project/webform_report

the webform project page says you can't use views with webform data:

Webform submissions are not nodes. This means that you can't use Views with submissions, setup custom access permissions to submissions, or do just about anything with them outside of what Webform provides for you.

thiruppathy’s picture

thanks for your reply.. here my detailed problem...

now am designing web site for real estate. for this customers want to search particular area to view properties. for this what i do for my site.

please refer this site for more information

"http://indiaproperties.com/propertysearch/searchproperty.aspx"

like above site i need to display particular area data.... for this you give any guidance for me..

markabur’s picture

sorry, no, i have no idea. but, you should start a new topic as this is now completely different than what you described in your original post.

thiruppathy’s picture

thanks for your reply... i want to create drop down menu.. for this i think i make a changes in page.tpl.php.... but am not sure... can you help me..otherwise any module provide this drop down menu facility... already i installed nice menu.. but it does not support my thinks... i installed sky and min.. theme also... but still confusing... clear my doubt pl........

scarer’s picture

you can add a block and use javascript in the block or in the header of your page.tpl.php file.

thiruppathy’s picture

hi drupal expert thanks for your reply.... i got solution for my problem.

i made a changes in page.tpl.php header section. inside of page.tpl.php file i linked one .js file. afterwords its working properly... once again thanks ya..