Community

Generating the titles from the articles into a block that I can use in the main page

Hello, I am furstrated as I am not the best PHP programmer.

The situation is the following:
I have a website (with a different main page) On that first page I have a field where I have the content from my articles displayed. I do not want to get the whole content there I want only the TITLES of these articles (and if it possible the articles of the last 5 articles) I am looking for the PHP code that could provide me with that solution. I want to do it in this way because when I change the appearances of that block for the main page it also changes the appearances throughout the rest of the website and I dont want to do that. Please could you be so kind and tell me what is the PHP code as I was looking within the Internet and the closest I could get was this http://api.drupal.org/api/drupal/modules%21block%21block.api.php/functio... and I could not understand how to display only the TITLE of the recent articles.

Thank you so much in advance

Comments

You can use the views module

You can use the views module to create such a block (or even a page), no need for coding.

Views is something that I

Views is something that I dont now how to use... I asked for the code because it would be the simplest thing to explain and it would take 5-6 minutes to write. I tried views but I am not sure that I can just add one block from views to the first page that is designed already.

Views is worth learning and

Views is worth learning and it is simply to create a view that lists the title of content.

From the views main page click 'Add new view'

Give the view a name.

If you only want a particular type change the drop down after 'of type' to the type you want.

Uncheck 'Create a page'

Check 'Create a block'

Give the block a title if you want.

Set the number of items you want displayed.

Save and Exit.

Visit the block admin page.

Enable the block by placing in the region of your choice.

Limit visibility so it only shows for the specified paths and set the paths to <front>

Thank you.

I want to thank you for your solution. I didnt realize that it is that easy to do that with Views... THANK YOU ! :)) it works perfectly :))