I am a newbie in Drupal,I have content-type "News" where the user adds news related to product. I want to show the latest 3 added news on content-type "Home-Page" (Home-Page is not front page).
What would be the standard way to get the desired output?
**I am using Drupal7
2 Answers
There are many, many ways to accomplish this but here is one of the simplest ways I can think of.
I'm going to use the Drupal Views module to do this. The intent of this is not to cover all things Drupal, rather it's to give you a crash course in creating a block using Views to accomplish what you're looking to do.
First, install and enable Views. There are several tutorials out there that show you how to do this. Nodeone has an awesome video introduction to Drupal Views. (Personally this is one of my favorite Drupal resources. :)
Now that Views is installed and enabled, go to Structure, then 'Views' (In D7 this will be at http://www.example.com/admin/structure/views
.)
Next create a new view (Add New View.)
Next, configure your View settings. The example settings below will create a new block that contains the three most recent News items that link to the full version of each article article. Views is capable of far more, but for the sake of simplicity I'll stick to creating a simple block.
Now go back to "Structure" and this time go to "Blocks."
My theme will be different from yours, but what you need to do is find the view you created, choose a location on your theme where you would like it to be displayed and then click save. In this example I'm moving the block to the top of the navigation bar on the right hand side of my theme.
Once saved you should see similar output on your site as in the image below. Note that this has my theme applied and your block will look different.
Lastly, to control which pages this block will be displayed on you can use the Blocks visibility settings. How do I show blocks only on certain pages? is a great resource.
There are likely a million other ways to accomplish this, but this was the quickest I could think of using my nifty Greenshot app.
-
thks for this clear description. i also think this is the best solution.– Mika A.Commented Feb 7, 2012 at 14:42
Check out the Views module. This allows you to make pages (or blocks or many other things) which can get data from your drupal installation. Very powerfull.
In your case, you use a view to get the top 3 items from the content type "News" sorted by date posted.