1 of 2
1
NEW !  EntryData Plugin. (Get custom fields without exp:weblog:entries)
Posted: 01 February 2008 10:07 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007

Hey everyone,

This is my first ExpressionEngine plugin.
I am sure the code can be done better..but i did my best.
I will continue to add more functions to the plugin overtime..

For now it can only fetch custom weblog fields.

Features
-Get custom field without (exp:weblog:entries), and with far less queries.
-Ability to get the FORMATTED or the RAW field (raw=unprocessed)
-Ability to choose between FIELD FORMATs
-Ability to get entry title (with only 1 query) // good for Page titles.
-Ability to get rows from exp_weblog_titles

How to?

%%%%% {exp:entrydata:field} %%%%%
%%%%%
Get PROCESSED custom field content from entry %%%%%
#### Parameters:
entry_id=""
url_title=""
weblog=""
weblog_id=""
field=""            // Custom field shortname (required!, or use field_id="")
field_id=""            // Custom field ID (required!, or use field="")
field_format=""        // Custom field format (if left empty, the custom field default assigned one will be used)
site_id=""



%%%%% {exp:entrydata:info} %%%%%
%%%%%
Get details of an entry %%%%%
#### Parameters:
entry_id=""
url_title=""
weblog=""
site_id=""
date_format=""     // If you selected a section that is a date, you can format it.
section=""         // A column found in exp_weblog_titles

Here as an list of sections on the default install of EE:
entry_id
site_id
weblog_id
author_id
pentry_id
forum_topic_id
ip_address
title
url_title
status
versioning_enabled
view_count_one
view_count_two
view_count_three
view_count_four
allow_comments
allow_trackbacks
sticky
entry_date
dst_enabled
year
month
day
expiration_date
comment_expiration_date
edit_date
recent_comment_date
comment_total
trackback_total
sent_trackbacks
recent_trackback_date

Example

// Fetch the BODY custom field based on EMBEDDED ENTRY_ID // use XHTML as field format
{exp:entrydata:field entry_id="{embed:entry_id}" field="body" field_format="xhtml"}

// Fetch the BODY custom field based on URL_TITLE // use NONE as field format
{exp:entrydata:field url_title="{segment_3}" field="body" field_format="none"}

// Fetch the RAW BODY custom field based on URL_TITLE . (Unprocessed, really RAW)
{exp:entrydata:field url_title="{segment_3}" field="body" field_format="raw"}

// Fetch the title of an entry.
{exp:entrydata:info url_title="{segment_3}" weblog="default" section="title"}

// Fetch the entry_date of an entry.
{exp:entrydata:info url_title="{segment_3}" section="entry_date" date_format="%D, %F %d, %Y"}

Bugs, Suggestions, questions, improvements, ideas...WELCOME !!!

Thanks to: Leevi Graham & Brent Wilson & Mitchell (Solspace) for their help.

Changelog
-1.1 // Fixed a looping bug (function re-declared)
-1.0.1 // Fixed ee_code being left out from the output
-1.0 // Global variables are now parsed & added exp:entrydata:info (get one of the columns from exp_weblog_titles)
-0.6 // Added entry_date & edit_date retrieval functionality (downloads: 96)
-0.4 // Added url_title retrieval functionality (downloads: 36)
-0.3 // Added title retrieval functionality (downloads: 28)
-0.2 // Bug fix in entry_id parameter (downloads: 17)
-0.1 // First Release (downloads: 34)

File Attachments
pi.entrydata_1.1.zip  (File Size: 3KB - Downloads: 105)
 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 01 February 2008 10:11 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  827
Joined  01-24-2006

Nice one… welcome to the EE developers guild… now I’ll have to show you the secret handshake.

 Signature 

leevigraham.com

VIEW ALL MY EE ADDONS!!

LG Polls 1.6
LG Better Meta 1.6
LG Twitter 2.0
LG Addon Updater 1.0
LG TinyMCE 1.3.0

Profile
 
 
Posted: 02 February 2008 04:36 AM   [ Ignore ]   [ # 2 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4901
Joined  04-15-2006

Hmm can I learn it too?

I know that the plugins I have made probably don’t even come close in matching up to what you are both doing but I am trying, honest!! grin

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 02 February 2008 05:53 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  827
Joined  01-24-2006
Mark Bowen - 02 February 2008 04:36 AM

Hmm can I learn it too?

I know that the plugins I have made probably don’t even come close in matching up to what you are both doing but I am trying, honest!! grin

Best wishes,

Mark

Of course… everyone is welcome!

 Signature 

leevigraham.com

VIEW ALL MY EE ADDONS!!

LG Polls 1.6
LG Better Meta 1.6
LG Twitter 2.0
LG Addon Updater 1.0
LG TinyMCE 1.3.0

Profile
 
 
Posted: 02 February 2008 06:12 AM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4901
Joined  04-15-2006

Thanks for this Victor. I will have to try this out later on this weekend.

Congratulations on your first plugin as well! grin

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 02 February 2008 11:18 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  138
Joined  05-18-2004

this looks handy.  thanks for sharing it.

 Signature 


EE Services & Migration • Blog Design Small Business Blogs & Websites • Site Development
Member of the EE Professional NetworkGet in touch today!

Profile
 
 
Posted: 04 February 2008 09:34 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007

Thanks for the great replies, today/tomorrow i will add url_title functionality.. If someone has some idea’s on which other info to fetch from entries..please..

Thanks

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 04 February 2008 11:56 AM   [ Ignore ]   [ # 7 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4901
Joined  04-15-2006

Hi Victor,

Works really really well! grin

What happens though if you place say five or six of these on a page to bring back just one field at a time. Is it still less intensive on SQL queries than using the weblog tag?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 February 2008 12:20 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007
Mark Bowen - 04 February 2008 11:56 AM

Hi Victor,

Works really really well! grin

What happens though if you place say five or six of these on a page to bring back just one field at a time. Is it still less intensive on SQL queries than using the weblog tag?

Best wishes,

Mark

Hi Mark,

Well it depends:
-If you now are using more then 1 {exp:weblog:entries} currently, then you can consider doing it.
-If you only are using 1 {exp:weblog:entries} in your template..not sure if it’s worth it then.

It is also good for embedded templates, when you want to pass a custom field to another template but don’t want to call {exp:weblog:entries} again in the embedded template.

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 04 February 2008 12:34 PM   [ Ignore ]   [ # 9 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4901
Joined  04-15-2006

Hi Victor,

Thanks for the reply. Not too sure I am totally understanding what you have said though so please excuse my asking again.
Let’s say for instance I was on a single-entry page and I had 15 custom fields that I wanted to bring back. At the moment as far as I can with most sites I only really ever have the one weblog tag on a page surrounding most everything. This would allow me to bring back the 15 custom fields. If instead on this single-entry page I placed 15 of your plugin tags would this still be less query intensive in that way or would the weblog tag be better off?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 February 2008 01:50 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007

Hi Mark,

In your situation the {exp:weblog:entries} is a better choice since you only call the tag once.

My plugin is useful for situations:
-Get custom fields of OTHER entries while inside of the {exp:weblog:entries} of another entry.
-Get custom fields of an entry while in an embedded template.
-Where you don’t want to use the {exp:weblog:entries} twice for just 1 or 2 custom fields.
-And some other situations where the {exp:weblog:entries} is overkill.

Thanks,
Victor

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 04 February 2008 05:59 PM   [ Ignore ]   [ # 11 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4901
Joined  04-15-2006

Hi Victor,

Thanks. That all makes perfect sense. I guess I hadn’t thought about its use completely when I asked that but just thought it was a valid question. I can definitely see good uses for this plugin and it is definitely one I will keep in my arsenal for the future.

Fantastic work for your first plugin. Totally puts mine to shame although in my defence mine were requested!! grin wink grin

Just kidding. Your plugin is fantastic and I am 100% positive you will get a lot of very positive feedback on it and let me be the first to give you 200% positive feedback grin

Thanks again for giving me some more examples to put my tired brain to rest.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 10 February 2008 10:05 PM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  509
Joined  04-24-2004

I’m sure this would be handy in different situations, but I think it would definitely be useful for grabbing an entry {title} for <title></title> tags in a page header. Saves using {exp:weblog:entries} just to turn everything off again.

 Signature 

lukestevensdesign.com · Design 2.0 · Pro Network member

Profile
 
 
Posted: 13 February 2008 03:34 PM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007
Luke Stevens - 10 February 2008 10:05 PM

I’m sure this would be handy in different situations, but I think it would definitely be useful for grabbing an entry {title} for <title></title> tags in a page header. Saves using {exp:weblog:entries} just to turn everything off again.

Hi,

You could use Title plugin by Lodewijk. It does exactly what you want.

In future version of the plugin i will incorporate Title also.

Thanks
-Victor

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 15 February 2008 12:14 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007

Updated the plugin to 0.2 // Fixed an entry_id parameter SQL error

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 15 February 2008 09:17 PM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007

Updated the plugin to 0.3 // Added title retrieval functionality

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 22 February 2008 12:20 PM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  605
Joined  07-02-2007

Updated the plugin to 0.6 // Added entry_date & edit_date retrieval functionality

Seems like it’s “feature” complete.

P.S. if anyone has an feature request please comment below.

 Signature 

Addons:
» EntryData Plugin (Get Custom_fields/etc without exp:weblog:entries)
» reCAPTCHA Extension
» Paginatee Paginate text with page_titles
» Rewrite Redirect URL’s to new ones (301/302/etc)
See all my addons

Profile
 
 
Posted: 19 May 2008 10:40 AM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  184
Joined  02-02-2007

It would be great if the output of {exp:entrydata:field} tag were identical to the output of {exp:weblog:entries} tag which pulls data from the same field.

Unfortunately there is quite serious difference. If you use {exp:weblog:entries} tag, you can enable EnpressionEngine’s code in it’s fields by wrapping them (or entire {exp:weblog:entries} tag) with Allow EE code plugin’s tags {exp:allow_eecode} and {/exp:allow_eecode}. But if you wrap with {exp:allow_eecode}{/exp:allow_eecode} tags the tag {exp:entrydata:field}, EnpressionEngine’s code does not get rendered. Even global weblog variables are being displayed uninterpreted.

Maybe there is some workaround to get parsed EnpressionEngine’s code pulled from a field via {exp:entrydata:field} tag?

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 20 May 2008 02:54 AM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  184
Joined  02-02-2007

Hi Victor,

One suggestion: it would be handy if not only “weblog_id” but also “weblog” were available
for use as parameter of {exp:entrydata:field} tag.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
   
1 of 2
1
 
‹‹ NEW - Neat Links Plugin…      Repeet Help ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 60727 Total Logged-in Users: 16
Total Topics: 73186 Total Anonymous Users: 15
Total Replies: 394715 Total Guests: 452
Total Posts: 467901    
Members ( View Memberlist )