expressionengine related entries dropdown value - expressionengine

I have 2 channels. Channel 2 has a dropdown select box relating to channel 1. I want to display all info regarding both channels on a single page:
{exp:channel:entries channel="channel1|channel2" require_entry="yes" limit="1"}
{title}
Channel1 info: {tag_from_channel1}
...
{reverse_related_entries id="channel2"}
...
{/reverse_related_entries}
{/exp:channel:entries}
I'm getting ID from {tag_from_channel1} instead of value. How can I display value instead of ID?

Try removing the require_entry="yes" parameter, which aide in your troubleshooting:
{exp:channel:entries channel="channel1|channel2" limit="1"}
{title}
{reverse_related_entries}
{title}
{/reverse_related_entries}
{/exp:channel:entries}
You can further debug your issue by eliminating the URL causing a problem by hard-coding your Channel Entries query with dynamic="off" and specifying a single entry with entry_id="99":
{exp:channel:entries ... dynamic="off" entry_id="99"}
Also, the {reverse_related_entries} tag shouldn't have an id= parameter. From the ExpressionEngine Relationship Documentation:
Unlike the Related Entries tag, the Reverse Related Entries tag does
not contain an ID parameter as there is no need.
Did you perhaps intend to use {related entries} instead?

Related

Access Categories for each entry of a specific channel in ExpressionEngine

So, I am still trying to figure out how to use expression engine and I want to create a list of all of the entries in a channel, which includes the corresponding categories. I can create the list as follows:
{exp:channel:entries channel="custom_channel"}
<div style = "display:block;padding:10px;border-bottom:1px solid #999999;">
<span>Title: {title}</span><br>
<span>Date published: {entry_date format="%m/%d/%y"}</span><br>
<span>Access: {access}</span><br>
<span>Type: {type}</span><br>
{!--Here is where I am trying to access the corresponding
categories for each of the entries--}
</div>
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:channel:entries}
So, what this does currently is it goes through the entries and creates the html as defined for each entry. I've tried to include {categories} and other related tags but have not been successful. I have looked online and have not been able to find anything related. Is it possible to access the corresponding categories for each entry? If so, how? Any help is appreciated. Thanks.
Yes, you can use the categories variable pair. Incidentally, if you're looking to tap into the ExpressionEngine community, post your questions to expressionengine.stackexchange.com

URL title to Entry ID on Channel Entries tag

I'm trying to use the "URL title to Entry ID" plugin to feed the entry_id parameter into a Channel Entries tag, but can't figure out a way to get the ID information inserted early enough in the template parsing order.
This doesn't work - it picks up no entry ID, and so displays all entries:
{exp:channel:entries entry_id="{exp:url_title_to_entry_id parse="inward" url_title="{last_segment}"}" dynamic="no"}
{title}
{/exp:channel:entries}
Any suggestions would be much appreciated.
You can't have a function tag as a parameter to another function tag.
So either you have to pass the {exp:url_title_to_entry_id} result as an embed variable to another template that holds the channel:entries tag, or you have to use tag pairs so that one function tag, wraps the other and uses variables.
url_title_to_entry_id doesn't allow for tag pair, so either use the embed technique, or use another add-on.
BUT, you don't need the add-on at all...
{exp:channel:entries url_title="{last_segment}" dynamic="no"}
{title}
{/exp:channel:entries}
reference.
I'd also suggest added required_entry="yes" and limit="1" and then add {if no_results}...{/if} conditional inside. This will prevent it outputting all entries if it can't find a match.

ExpressionEngine content based on url segment

I'm just learning EE and I have the following example url, http://mydomain.com/work/preview/clientname
where I want clientname to match a channel field I have setup ("client_name") and to pull in channel content only if it matches that channel field.
For example, http://mydomain.com/work/preview/google, would display channel content if the specified channel field "client_name" for a particular entry is "google".
I know how to use the following to pull in content from the channel "videos":
{exp:channel:entries channel="videos"}
{title}
{/exp:channel:entries}
...but how do I accomplish this for different url segments?
I believe what you're looking for is searching the channel entries tag by field name.
Here's an example:
{exp:channel:entries channel="videos" search:client_name="google"}
{title}
{/exp:channel:entries}
Do keep in mind though if you want to use the segment for this you'll likely have to pass the segment through an embed as a variable. You can read about this here.
Making this change works for me:
{exp:channel:entries channel="videos" dynamic="no" search:client_name="segment_2"}
{title}
{/exp:channel:entries}

Expression Engine - How do I display external links in Category Archive List?

I have a series of entries that need to be displayed as part of a Category Archive.
I did the code this way:
{exp:channel:category_archive channel="botanical_gardens" style="linear"}
{categories}
<h3>{category_name}</h3>
{if category_description}
<p>{category_description}</p>
{/if}
{/categories}
{entry_titles}
{title}<br />
{/entry_titles}
{/exp:channel:category_archive}
This works with the exception of the URL which ties into the site url. Since each of these entries link to outside sites, how do I write the code to get the correct URL?
Thanks!
Custom fields can't be displayed within the Category Archive tag. Instead, you'll have to use the Channel Categories tag, and put a Channel Entries tag within it.
{exp:channel:categories channel="botanical_gardens" style="linear" disable="category_fields"}
<h3>{category_name}</h3>
{if category_description}
<p>{category_description}</p>
{/if}
{exp:channel:entries channel="botanical_gardens" category="{category_id}" disable="member_data|pagination|categories"}
{title}<br />
{/exp:channel:entries}
{/exp:channel:categories}

Related entries in a Safecracker form?

I'm trying to create a Safecracker form in ExpressionEngine to create a recipe. I have a recipe channel, which can have many ingredients from an ingredients channel (using the multi-relationship add-on from devot:ee). However, I'm having trouble listing the ingredients within my form. This is my mark-up:
{exp:safecracker channel='recipes' datepicker='no' id='add-recipe-form' include_jquery='no' return='recipes/view/ENTRY_ID' safecracker_head='no'}
{related_entries id='ingredients'}
{title}
{/related_entries}
{/exp:safecracker}
The problem is, the actual EE tags are just getting output on my web page.
I figure I'm doing something fundamentally wrong, so could someone point me in the right direction? Thanks.
This is called "variable collision" - you're nesting entries which use the same variable/tag names as those used by the parent tag (in this case, {title}), and due to how EE's parse order works, the parent tag is winning every time.
The solution is to put your above code into another template, and embed that template within your Safecracker form. Embeds are run at the very end of template processing, after all of the other EE tags are parsed, so you won't run into the same collision.
Derek is right, you need to embed your related entries. I've got this working on my Toronto EE meetup site with this code.
Simplified Template code:
{exp:safecracker channel="gta-attendee"}
<div class="form_row" style="display:none;">
<label class="small">Choose Meetup to Attend:<span class="required">*</span></label>
{embed="includes/_playa_select" selected="{attendee-event:child_ids}" }
</div>
{/exp:safecracker}
embedded code:
{exp:channel:entries dynamic="no" channel="gta-meetup" limit="1"}
<input value="{entry_id}" name="attendee-event[selections][]" type="hidden">
{/exp:channel:entries}
In the code I'm using the Playa Module, but the principle is the same.
Hope this helps
Sean

Resources