Newscoop 3 Cookbook

Introduction to Newscoop objects

The Newscoop template engine stores the template environment in an object named 'gimme'. All Newscoop properties and objects are attributes of the $gimme object.

The $gimme object has the following attributes which are not objects:

  • version: the Newscoop version
  • preview: true if the page was displayed in the preview window (by a Newscoop staff user)
  • prev_list_empty: true if a list was displayed before querying this attribute and this list was empty

Any Newscoop object (e.g.: $gimme->language, or $gimme->article ) has the following functions:

  • has_property("property_name")

Returns true when the object has the given property. This function can be used for dynamic article properties too. For example, $gimme->article->has_property("name") will return true.

  • same_as($gimme->other_object)

Returns true if the object variable given as a parameter points to the same data as the current object. For example, {{ if $gimme->article->same_as($gimme->default_article) }} will return true if the current article was the same as the article defined at the beginning of the template. If both were undefined this function returns true.