EE 1
EE 2
Active Record
Developer
3rd Party (Free)
Download v1.0.3
Compatibility
- LG Addon Updater
- Multi Site Manager
- Stand Alone Entry Form
Requirements
- jQuery for the Control Panel
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
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 Version | Downloads | Add-On Version | Release Date |
|---|---|---|---|
| 2.+ | Download | 1.0.3 | 2010-10-16 12:00 AM |
Active Record Links
This entry was last updated April 20, 2012, 3:56 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!
2 Reviews:
VosSavant 05.27.11
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
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.