Active Record

Developer

Rob Sanchez

3rd Party (Free)

588 downloads (last 90 days)

Download v1.1.2

EE Version Support

  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

Use the CodeIgniter Active Record pattern in an ExpressionEngine plugin.

See http://codeigniter.com/user_guide/database/active_record.html#select

The tag parsing is the equivalent of the Query module tag parsing: http://expressionengine.com/user_guide/modules/query/index.html

System Requirements

Requires ExpressionEngine 2.8+. If you need to support an older version of EE, use version 1.0.4.

Installation

Copy the /system/expressionengine/third_party/activerecord/ folder to your /system/expressionengine/third_party/ folder

Usage

{exp:activerecord
    select="member_id, username"
    from="members"
    where:group_id="1"
    order_by="screen_name"
    limit="10"
    paginate="top"
}
    {!-- this parses exactly like a query module tag --}
    {member_id} - {username}<br />
    {paginate}<p>Page {current_page} of {total_pages} pages {pagination_links}</p>{/paginate}
{/exp:activerecord}

Variables

{your_field_name}
{switch="option_one|option_two|option_three"}
{count}
{total_results}
{absolute_total_results}
{paginate}<p>Page {current_page} of {total_pages} pages {pagination_links}</p>{/paginate}

Conditionals

{if no_results}{/if}

Parameters

select

select="member_id, username"

protect your select statement

select="COUNT(*) AS count"
protect_select="yes"

from (required)

from="members"

where
a where key/value pair

where:group_id="1"

a where statement (not key/value pair)

where="MATCH (field) AGAINST ('value')"

multiple where statements

where[a]="MATCH (field) AGAINST ('value')"
where[b]="MATCH (field2) AGAINST ('value2')"

like
not_like
or_like
or_not_like

use :before or :after to modify the location of the wildcard in the like statement

like:screen_name="Joe"
or_like:screen_name:before="oe"

distinct

distinct="yes"

order_by

order_by="screen_name"

group_by

group_by="group_id"

join
on is required with a join, join_type is optional

join="channel_data"
on="channel_data.entry_id = channel_titles.entry_id"
join_type="left"

where_in
or_where_in
where_not_in
or_where_not_in
separate multiple values with a pipe character

where_in:entry_id="1|2|3|4"

Download Active Record

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.1.2 Jun 5, 2014

Active Record Links

This entry was created October 20, 2010, 11:57 am.
This entry was last updated June 5, 2014, 8:44 am.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

2 Reviews:

VosSavant 05.27.11

VosSavant
Rating - {addon_rating_average}

Absolutely awesome. I find this to be easier to understand than the query module. The big bonus is, like Mark said: using it to pull only what you need from the db, thus cutting out a lot of processing overhead.

Mark Bowen Design 02.28.11

Mark Bowen Design
Rating - {addon_rating_average}

This is a really great add-on if you understand SQL queries then this can really shave off a lot of overhead of the channel entries tag for certain elements that you might need on your site.