rsanchez / activerecord Goto Github PK
View Code? Open in Web Editor NEWUse the CodeIgniter Active Record pattern in an ExpressionEngine plugin.
Home Page: http://devot-ee.com/add-ons/activerecord/
Use the CodeIgniter Active Record pattern in an ExpressionEngine plugin.
Home Page: http://devot-ee.com/add-ons/activerecord/
Great plugin!
Here's my code and you'll see what I'm trying to do:
where:exp_forms_entries.member_id="{member_id}"
or_where:exp_forms_entries.fid_1010="exp_forms_entries.fentry_id"
It's evaluating the "exp_forms_entries.fentry_id"
as a string, rather than database field. Possible?
Grmbl, memberdata is parsed late in the template parsing process.
Making it difficult to fetch profile fields for the current user.
Added the following in build_query
foreach ($params as $method => $value)
{
// some normally late parsed variables that are already in the session
if($value=="{member_id}") $value = $this->EE->session->userdata['member_id'];
I've tried
join[a]="channel_data"
...
join[b]="relationships"
Thinking it might work like where
, but this doesn't do any of the joins. I've also tried
join="channel_data"
...
join="relationships"
But this only does the last join.
Trying to use the code below to grab the most popular purchased item from my cart throb purchased items channel but only shows titles alphabetically. Any ideas of what I may be doing wrong? Thanks!
{exp:activerecord select="title, COUNT(title) AS score" from="channel_titles" where:channel_id="9" group_by="title" sort_by="score desc"}
Hey,
This is more of a support ticket than an issue. I'm running a query that includes a join. As expected, when the join value is blank, it does not return a result. However, in my case, I want to allow that -- so that the rest of the values in the result still populate. Could you maybe provide me some advice? I'm using the exp:vz_tabular:csv
to get this data into a csv. The join that is needed to be 'conditional' or 'eligible to be blank' is join:exp_channel_titles="exp_forms_entries.fid_1068 = exp_channel_titles.entry_id"
. Thanks for any advice!
{exp:vz_tabular:csv filename="wart-haig-waiver.csv"}
{exp:activerecord
select="
exp_forms_entries.fentry_id,
exp_channel_data.field_id_696,
exp_channel_data.field_id_679,
exp_forms_entries.fid_1037,
exp_forms_entries.fid_1031,
exp_forms_entries.date,
exp_forms_entries.fid_1128,
exp_forms_entries.fid_1029,
exp_channel_data.field_id_718,
exp_channel_data.field_id_719,
exp_channel_data.field_id_452,
exp_forms_entries.fid_1068,
exp_forms_entries.fid_1037,
exp_channel_titles.title,
exp_members.email"
from="exp_forms_entries"
where:exp_forms_entries.form_id="37"
join:exp_channel_titles="exp_forms_entries.fid_1068 = exp_channel_titles.entry_id"
join:exp_channel_data="exp_forms_entries.fid_1067 = exp_channel_data.entry_id"
join:exp_members="exp_forms_entries.member_id = exp_members.member_id"
{if get:event_name != ''}
like:exp_forms_entries.fid_1037="{get:event_name}"
{/if}
}
[col Entry ID]{fentry_id}[/col]
[col Date]{date format="%m-%d-%y"}[/col]
[col First Name]{field_id_718}[/col]
[col Last Name]{field_id_719}[/col]
[col Email]{email}[/col]
[col Address]{field_id_696}[/col]
[col Role]participant[/col]
[col Sport]{fid_1031}[/col]
[col Gender]{field_id_679}[/col]
[col Grad Year]{field_id_452}[/col]
[col Coach's Name]{fid_1128}[/col]
[col Coach's Email]{fid_1129}[/col]
[col Club]{title}[/col]
[col Event]{fid_1037}[/col]
{/exp:activerecord}
{/exp:vz_tabular:csv}
Hey Ron,
I'm wondering if there's a way to parse an array / hash. I'm working with VZ Address field, with my goal to separate the output as individual fields. Sample:
{"street":"583 King of Prussia Rd","street_2":"","city":"Radnor","region":"PA","postal_code":"19087","country":"US"}
Please ignore - my mistake!
Following not working (not parsing stash tag variable)
{exp:activerecord
select="author_id, title"
distinct="yes"
from="channel_titles"
where="channel_id = 15"
where_in:author_id="{exp:stash:get name='stash_product_authors'}"}
I have tried to use a variety of Excerpt plugins on the results and they all get ignored .. one example one http://devot-ee.com/add-ons/excerpt1
{exp:excerpt limit="5"}{description}{/exp:excerpt}
It will just output the full description. Is there anything in this plugin that would prevent tags being used like this?
Thanks!
Hello,
I do not know if i am doing something wrong or it is the plugin. I set this query up so it will return no records so i can test the no_results. When i run it, my web page is blank. Here is the code;
{exp:activerecord
select="channel_titles.title AS title,
channel_titles.url_title AS article_link,
channel_data.field_id_6 AS authors,
channel_data.field_id_7 AS conference,
channel_data.field_id_8 AS keywords,
channel_data.field_id_10 AS file,
channel_data.field_id_16 AS article_type,
channel_data.field_id_19 AS external_link,
channel_data.field_id_15 AS publication,
channel_data.field_id_21 AS year,
channel_data.field_id_17 AS volume,
channel_data.field_id_13 AS issue,
channel_data.field_id_14 AS pages"
protect_select="yes"
from="channel_titles"
left_join:channel_data="channel_data.entry_id = channel_titles.entry_id"
where:channel_data.channel_id = "7"
limit="15"
paginate="both"
}
{!-- this parses exactly like a query module tag --}
{if no_results}<h3>We're sorry, but we couldn't find anything for you. Please try another search.</h3>{/if}
{title}<br />
{article_link}<br />
{authors}<br />
{conference}<br />
{keywords}<br />
{file}<br />
{article_type}<br />
{external_link}<br />
{publication}<br />
{year}<br />
{volume}<br />
{issue}<br />
{pages}<br /><br />
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:activerecord}
Since there is no id of 7 here, where:channel_data.channel_id = "7", I should get no records back and trigger the no_results if statement but it does not. I just get a blank page.
Regards,
Stephen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.