8

Is there any known way to get all the entries from a certain channel? I dont want to do this in a view but in PHP since i need to do a bulk update of an attribute to all the entries in a certain channel.

mbalparda
  • 647
  • 6
  • 18

1 Answers1

12

You would do that using an ElementCriteriaModel:

$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section = 'mySectionHandle';
$criteria->limit = null;

$entries = $criteria->find();

You can read all about how to work with ElementCriteriaModel’s in the Working with Elements guide in the Craft docs.

Victor
  • 8,376
  • 1
  • 34
  • 61
Brandon Kelly
  • 34,307
  • 2
  • 71
  • 137