The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.
This plugin allows you to output the value of single custom field of certain entry without using exp:weblog:entries. It can be seen as a replacement of EntryData plugin which was available at www.trulyee.com
PARAMETERS
1) field - Required. Allows you to specify field name.
2) entry_id - Optional. Allows you to specify entry id number.
3) weblog - Optional. Allows you to specify weblog short name.
4) url_title - Optional. Allows you to specify url_title.
Either “entry_id” or “weblog” and “url_title” parameters must be defined.
5) field_format - Optional. Allows you to specify how field data should be formatted. Possible values: “html”, “br”, “none”, “lite”, “raw”. In case this parameter is left undefined, format info will be retrieved from database. In case parameter’s value is “raw”, data will be outputted without any format applied.
6) site - Optional. Allows you to specify site id number. Default is “1”.
7) invalid_input - Optional. Accepts two values: “alert” and “silence”. Default value is “silence”. If the value is “alert”, then in cases when the plugin has some problem with parameters, PHP alert is being shown; if the value is “silence”, then in cases when the plugin has some problem with parameters, it finishes its work without any alert being shown. Set this parameter to “alert” for development, and to “silence” - for deployment.
8) allow_img_url - Optional. Allow inline images? Possible values: “yes” and “no”. Default is “no”.
9) auto_links - Optional. Auto-link URLs and email addresses? Possible values: “yes” and “no”. Default is “yes”. (Note that auto-linking does not ever occur if parameter “html_format” is set to “none”)
10) encode_email - Optional. Whether or not email addresses are encoded. Possible values: “yes” and “no”. Default is “yes”.
11) encode_type - Optional. Type of encoding applied to email addresses if email address encoding is enabled. Possible values: “javascript ” and “noscript”. “noscript” renders in a human readable format (e.g. “name at example dot com)”, suitable for use where JavaScript is inappropriate, such as in a feed.
12) html_format - Optional. Controls how HTML is handled in text. Possible values: “safe”, “all”, “none”. Default is “safe”.
13) parse_smileys - Optional. Replace text smileys with smiley images? Possible values: “yes” and “no”. Default is “yes”.
14) field_is_date - Optional. Accepts two values: “yes” and “no”. Default value is “no”. Set this parameter to “yes” in case custom field contains date.
15) date_format - Optional. Used in case “field_is_date” parameter is set to “yes”. Allows to specify ExpressionEngine’s date format.
16) date_localize - Optional. Used in case “field_is_date” parameter is set to “yes”. Allows you to specify if the date should be localized. Accepts two values: “yes” and “no”. Default value is “no”.
EXAMPLE OF USAGE
With “entry_id” parameter defined:
{exp:single_field field="my_custom_field" entry_id="251" site="1" field_format="xhtml"}
With “weblog” and “url_title” parameters defined:
{exp:single_field field="my_custom_field" weblog="my_weblog" url_title="my_blog_title" site="1" field_format="raw"}
Thanks for putting this plugin together! I tried using it today in the following context:
{exp:child_categories parent="{category_id}" weblog="menus" child_categories_sort_by="custom" show_empty="yes" child_categories_sort_direction="asc"}
{child_category_start}
{if "{child_category_image}"!=""}
{child_category_image}
{if:else}
<h2>{child_category_name}</h2>
{/if}
{child_category_end}
{entries_start}
<h3>{title}</h3>
{exp:single_field field="item-description" entry_id="{entry_id}"}
{entries_end}
{/exp:child_categories}
I received this error:
Notice: Undefined index: field_ft_15 in /home/nancysre/public_html/manage/plugins/pi.single_field.php on line 143
If I manually put in an entry id (“5” for example) the data is pulled from the database. If I remove the quotes from “{entry_id}” then there is no PHP notice but no data appears. If I just have {entry_id} in that paragraph tag as opposed to the exp:single_field…. then the entry ID is displayed.
Am I approaching this incorrectly? Thanks!
Laisvunas,
I was wondering how this compares to the Reeposition plugin by Mr. Wilson?
By description, they seem to do almost the same thing? I’ve noticed you’ve also tried Mr. Wilson’s plugin yourself. Was wondering if you had some views on them both.
Thanks again for your wonderful contributions!
@stinhambo Can you provide an example of your code?
@Danny Single Field plugin and Reeposition plugin have nothing in common: Reeposition has the purpose to move piece of content from one place in the page to other(s); Single field has the purpose to output contents of one custom field of certain entry.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.