We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Field Value

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.

This plugin allows you to output values of custom fields of certain entry without using exp:weblog:entries.

PARAMETERS:

1) entry_id - Optional. Allows you to specify entry id number.

2) weblog - Optional. Allows you to specify weblog short name.

3) url_title - Optional. Allows you to specify url_title.

Either “entry_id” or “weblog” and “url_title” parameters must be defined.

4) field_format - Optional. Allows you to specify how field data should be formatted. 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.

5) site - Optional. Allows you to specify site id number. Default is “1”.

6) 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.

7) allow_img_url - Optional. Allow inline images? Possible values: “yes” and “no”. Default is “no”.

8) 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”)

9) encode_email - Optional. Whether or not email addresses are encoded. Possible values: “yes” and “no”. Default is “yes”.

10) 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.

11) html_format - Optional. Controls how HTML is handled in text. Possible values: “safe”, “all”, “none”. Default is “safe”.

12) parse_smileys - Optional. Replace text smileys with smiley images? Possible values: “yes” and “no”. Default is “yes”.

VARIABLES:

As a single variable can be used any field name of the entry with “field_value_” added at the beginning. For example if entry has such fields as “article_body” and “formatted_title” we can use such single variables as {field_value_article_body} and {field_value_formatted_title}.

Conditionals are not supported.

EXAMPLE OF USAGE:

{exp:field_value entry_id="251"}
<h1>{field_value_formatted_title}</h1>
{field_value_article_body}
{/exp:field_value}
       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

This (and all of your other plugs) rocks! Thank you!!!

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

Hello,

Just wanted to post info about a small bug.

After installing, I went to the plugins page and saw this:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/user/public_html/system/plugins/pi.field_value.php:281) in /home/user/public_html/system/extensions/ext.lg_htaccess_generator_ext.php on line 672

I fixed the error by deleting all the spaces after the closing php tag at the end of your plugin.

PHP Version 5.2.5 ExpressionEngine v 1.6.8

Thanks! Micky

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi Micky,

I fixed the error by deleting all the spaces after the closing php tag at the end of your plugin.

Thanks for reporting; fixed.

I know that white space at the end of PHP file can cause various issues, but my favorite text editor inserts it and I sometimes forget to delete it… :long:

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

Thanks for fixing! Like I said before, I love all of your addons! You do excellent work.

This plugin is saving me from having to use the weblog:entries tag for a bunch of extraneous stuff. 😊

Cheers! Micky

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

I released version 1.2 of Field Value plugin.

In this release several new parameters were added allowing more control over formatting of the field values: “allow_img_url”, “auto_links”, “encode_email”, “encode_type”, “html_format” and “parse_smileys”.

About using these parameters read in the first post of this thread.

       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

I’m guessing the advantage of this plugin is it’s a lot lighter on database queries?

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

Yes, it’s lighter on database queries.

In addition to that this plugin can be used inside exp:weblog:entries tag pair, or exp:weblog:entries tag pair can be wrapped by exp:field_value tag pair; you cannot nest two exp:weblog:entries tags.

       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

Hi,

maybe i’m being stpuid but i don’t get how t use this. I want the following to ouput the title for my entry. Have i misunderstood the “field_value” prefix?

{exp:field_value url_title="1343"}{field_value_title}{/exp:field_value}
       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

Hi NKT,

Note the placement of the “or” and the “and”:

Either “entry_id” or “weblog” and “url_title” parameters must be defined.

I could be wrong, but it looks like you also need an entry_id or weblog param defined. 😊

       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

Thanks for your reply. I’m trying this…

{exp:field_value weblog="{segment_1}" url_title="{segment_2}"}{field_value_title}{/exp:field_value}

But it comes back with this error 😝

MySQL ERROR:

Error Number: 1054

Description: Unknown column 'field_id_' in 'field list'

Query: SELECT field_id_, field_ft_ FROM exp_weblog_data WHERE entry_id = '1343' LIMIT 1
       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse
{exp:field_value weblog="{segment_1}" url_title="{segment_2}"}{field_value_title}{/exp:field_value}

Quick question… Are you sure that segment_1 and segment_2 are returning what you expect?

       
Laisvunas's avatar
Laisvunas
879 posts
15 years ago
Laisvunas's avatar Laisvunas

Hi,

This plugin outputs only values of custom fields; it does not output the value of title field.

       
smartpill's avatar
smartpill
456 posts
15 years ago
smartpill's avatar smartpill

If you’re looking to output the title, Low’s Title Plugin works really well.

       
NKT com's avatar
NKT com
124 posts
15 years ago
NKT com's avatar NKT com

How early is this tag parsed?

Would it be possible to turn this into a single tag also to reduce space…

{exp:field_value entry_id="251" field="extented_summary"}

This plugin could be perfect for setting site wide interface settings and text if it was passed early enough.

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.