Expression Engine entry_id Parse - expressionengine

Hey Everyone I am having a huge problem :
I have this Line :
{exp:entries:ids_assigned_to_me tag="idont" channel="proiecte" field="clienti"}
Which outputs me some entry ids
and i can put it There at the entry_id:
{exp:channel:entries channel="proiecte" entry_id=" HERE " }
{content}
{/exp:channel:entries}
I tryied and search for hours over forums and stuff, but variable, snippets and embeding and stuff doesen't seemed to work out. Any Ideas ? about Inward Parse or something ?
Also tried php but didn't worked out :((

You're using the entries add-on and by the looks of it you're using the single tag method. It's not clear from the documentation, but I think as you're specifying a single tag, it's outputting the IDs, but if you use it as a tag pair (as other examples in the documentation show) and this piece of documentation hints at: "If no entries are assigned the logged in member, the no_results conditional is returned.".
So first try
{exp:entries:ids_assigned_to_me tag="idont" channel="proiecte" field="clienti"}
{content}
{/exp:entries:ids_assigned_to_me}
...all by itself without any {exp:channel:entries} tags. No idea what "tag" parameter is doing in there.
If that doesn't work and that method doesn't support a tag pair, then you'll need to do as an embed across 2 templates:
1st template:
{embed=template-group/second-template entry_ids="{exp:entries:ids_assigned_to_me tag="idont" channel="proiecte" field="clienti"}"}
2nd template:
{exp:channel:entries channel="proiecte" entry_id="{embed:entry_ids}"}
{content}
{/exp:channel:entries}

Related

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.

Passing entry_ids to channel:entries tag with low variables entries select

I'm trying to pass entry_ids to a channel entries tag using low variables entry_select. When i place the following tag by itself in a template it outputs a list of 3 pipe separated entry_ids: {exp:low_variables:single var='lv-home-groups'}
however when I add the same code to the following channel:entries tag nothing is output.
{exp:channel:entries channel="groups" entry_id="{exp:low_variables:single var='lv-home-groups'}" disable="category_fields|pagination"}
code here
{/exp:channel:entries}
I've tried early and late parsing but can't get it to work. If i manually place the entry_ids it works fine. I'm trying to avoid using an embedded template for performance reasons.
Here's how: make sure early parsing is enabled for that variable, and then use the variable syntax instead of the tag syntax:
{exp:channel:entries channel="groups" entry_id="{lv-home-groups}"}
code here
{/exp:channel:entries}

Redirect when last segment missing

I have a single entry url structure like:
www.site.com/template_group/template_1/entry_id
But I want it to be:
www.site.com/template_group/template_1/entry_id/url_title.
Entry_id would be the segment feeding exp:channel:entries. How can I redirect www.site.com/template_group/template_1/entry_id to www.site.com/template_group/template_1/entry_id/url_title.
Thanks a lot!
Something like the following should work - it's untested, but it'll give you a good idea of how to go forward with it.
{if segment_4==""}
{exp:channel:entries channel="x" limit="1" dynamic="no" entry_id="{segment_3}"}
{redirect="template_group/template_1/{entry_id}/{url_title}"}
{/exp:channel:entries}
{/if}
put this at the very top of your template:
{if segment_4 == ""}
{exp:channel:entries channel="channel_goes_here" entry_id="{segment_3}"}
{redirect="{site_url}/{segment_1}/{segment_2}/{segment_3}/{url_title}
{/exp:channel:entries}
{/if}
This will check if you have set a fourth segment, if not it takes the third segment containing your entry_id, feeds it to the channel entries tag, which returns the url_title you need. With this url_title you can easily redirect to the correct page.
Good answers from janvl and madebyhippo
Quick note if you are using complex conditionals (the ones in the answers are simple ones so you will not have that problem) is that EE will parse the channel entries tags they contain, wich can slow down performance.
If you find yourself in that situation, best to avoid the problem altogether using Mark "The croxton" addons like switchee or ifelse

Expression Engine - Pass loop variable into embeded template

have some trouble with Expression Engine variable passing in templates.
There is some piece of code:
// query:
{exp:channel:entries
channel="static"
}
// repeating field in a loop
{content_matrix}
<div>
{text_cell}
</div>
{image}
{/content_matrix}
//
{/exp:channel:entries}
I want to move content_matrix field with big inner HTML (example is shorter) sctructure into separate embed template for reusage in other templates.
Tried to build such embed but it doesnt work:
{embed="incl/content_matrix" matrix="{content_matrix}"}
And body of smaller template:
{embed:matrix}
<div>
{text_cell}
</div>
{image}
{/embed:matrix}
In this way it works if you passing single element, like ID, but not for mupltiple element.
Maybe it needs to pass entire entry.
How it can be done?
Thanks.
Have you considered using the Stash add-on?
I imagine you can stash the matrix content dividing between different parts of your html with some kind of separator, then in the embedded template wrap a search/replace for the separators with the proper html around the grabbed stash.
It might be less of a pain to write a quick, custom plugin, though.
Embed variables pass parsed output, not tags. So in your example:
{embed="incl/content_matrix" matrix="{content_matrix}"}
What you're actually passing in the matrix parameter is the full HTML table output of the data in that particular entry (since Matrix fields output a table when used as a single tag).
I think what you actually want to use to prevent repeating yourself is a Snippet. So just make a snippet containing:
{content_matrix}
<div>
{text_cell}
</div>
{image}
{/content_matrix}
And save it as, say, matrix_loop. Then include it inside your Channel Entries loop like so:
{matrix_loop}

Pagination on Single-Entry view in ExpressionEngine

I am building a website with ExpressionEngine as the CMS. There is a "Work" section that displays all the projects, and a detail view that shows each project individually. It is at this point, on the single-entry view that I would like to have "prev" and "next" pagination. In my tests I have made it work when the URL is "somedomain.com/index.php/work/detail/" but it does not work when the specific entry is part of the URL: "somedomain.com/index.php/work/detail/some_project/"
I've tried putting the pagination code outside of the {exp:weblog:entries} tag as well as within it, but to no avail. This is what my pagination code looks like:
{paginate}
<ul>
{if previous_page}
<li>< previous</li>
{/if}
{if next_page}
<li>next ></li>
{/if}
</ul>
{/paginate}
You are using pagination for lists of entries, what you need is the next / previous entry tags:
http://expressionengine.com/user_guide/modules/channel/entry_linking.html
Hmm. I'm not sure what the issue is here, as I've never used the {pagination} tag in that way. After checking out the docs, I see that the example code for prev/next links inside of the {pagination} tag is wrapped inside of an {exp:comment:entries} loop instead of the normal {exp:channel:entries} loop.
The docs aren't very clear about the scope of this particular feature of the {pagination} tag. You might want to double check that, in your {exp:channel:entries} loop, you haven't included pagination as a value in the disable parameter.
You could also check out the page in EE's user guide about Next/Prev Linking, which details the use of {exp:channel:next_entry} and {exp:channel:prev_entry} tags in place of the {pagination} tag that you've been using. I've used these tags without a hitch, so I definitely recommend trying them if you can't get your method to work.
Best of luck!

Resources