Jump to content

Recommended Posts

Posted

pls help

I made a news template with various fields and I want my list to appear automatically on the main page with all the news names
how to do it

sorry for my bad english

Posted

In you home template, you could do something like:

<?php
	$newsArticles = $pages->find('template=your_news_templates');
	foreach ($newsArticles as $newsArticle) {
		echo "<a href=\"" . $newsArticle->url . "\">" . $newsArticle->title . "</a>";
	}
?>

This would output each article's title (as well as a url to the article). Obviously you can change the markup to whatever you would need.

  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...