Saturday, December 5th, 2009 (updated 26 Apr ’15)

Documentation for External Entries v2.6.4

 
  • Version
    2.6.4
  • Type
    Plugins
  • More info
  • Elsewhere
    "EE Forums thread":http://expressionengine.com/forums/viewthread/145112/ "Devot-ee page":http://devot-ee.com/add-ons/plugins/external-entries/ "Programattically/automatically adding weblog entries":http://expressionengine.com/forums/viewthread/145382/
  • Download

Select

h2(#select-function). Parameters for exp:external_entries:select h3. Required parameters h4. table= Required. This is the table to be operated on. h3. Optional parameters h4. allow_php= Lets the plugin's values contain PHP. Values are "y" or "n"; default is "n" (for security). Set to "y" for characters such as greater than/less than signs to not be converted to entities. h4. connection= Set to "persistent" if using an external database and EE's database settings are for non-persistent connections. h4. database= Required if using an external database. h4. debug= "y" or "n". If set to "y" then the SQL will be displayed on the page for debugging instead of the results. h4. distinct= Use with the Select method. If set to "yes", "y" or "true" then only unique rows are displayed. h4. hostname= Required if using an external database. h4. limit= Works like in the channel:entries tag; the default is 100. h4. orderby= Works like in the channel:entries tag. Separate multiple fields with the pipe "|" character. h4. parse= Setting parse="inward" allows another plugin to be placed within Select Entries. (This is a universal parameter that works in all plugins.) h4. password= Required if using an external database. h4. search:[column_name]= Searches can be based on any column name, ie, search:my_column="my text". See the "documentation for the ExpressionEngine channel parameter search:field_name=":http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#id52 for syntax rules. h4. sort= Works like in the channel:entries tag, except it requires the orderby= parameter to do anything as there's no default key. Separate multiple fields with the pipe "|" character. h4. username= Required if using an external database. h2. Variables for exp:external_entries:select

{select:count}

Works like {count} in the channel:entries tag.

{select:total_results}

Works like {total_results} in the channel:entries tag except that if there are no results the plugin won't loop, so it can't be used for a "no results" conditional.

{select:[column_name]}

Displays that column's value for the current row. h2. Examples for exp:external_entries:select For the table exp_actions, which is part of our ExpressionEngine database, we want to show all entries, sorted by the action_id column in ascending order:
{exp:external_entries:select table="exp_actions" limit="999" orderby="action_id" sort="asc" }
{if "{select:count}"=="1"}
<table>
	<tr>
		<th>Action ID</th>
		<th>Class</th>
		<th>Method</th>
	</tr>
{/if}
	<tr>
		<td>{select:action_id}</td>
		<td>{select:class}</td>
		<td>{select:method}</td>
	</tr>
{if "{select:count}"=="{select:total_results}"}
</table>
{/if}
{/exp:external_entries:select}
For table exhaust_outlets, which is outside our EE database, we want to show 15 entries, sorted by the reactor column in ascending order, where the circumference column equals "medium" and the shape column equals "straight":
{exp:external_entries:select 
	hostname="mysql.deathstar.com" 
	username="deathstar_vader" 
	password="luk35dad" 
	database="deathstar_plans"  
	table="exhaust_outlets" 
	search:circumference="medium"
	search:shape="straight"
	orderby="reactor" 
	sort="asc" 
	limit="15" 
}
<p>{select:title} is connected to the {select:reactor} reactor and is exposed at {select:mouth_location}!</p>
{/exp:external_entries:select}

Post a comment

Name:

Email:

Location:

URL:

Your comment:

Remember my personal information
Notify me of follow-up comments?

Please enter the word you see in the image below: