So with your plugin, I’m assuming (hoping) I can from weblog 3 (a news entry) traverse thru the relationships weblog 3 > weblog 2 > weblog 1 and display data from weblog 1? Do you have plans on porting over to 2.0?
Yep, it’ll do that! And yes, it’ll be ported over to 2.0 sometime before Dec 1st.
Adam,
I’m finally getting around to using your plugin. I gotta say thus far, it’s been a lifesaver. Ever tried to organize reverse related results by category? OMG what a pain.
Tied Entries to the rescue! It seems that I can apply the “category” parameter to your tied entries tag, define a reverse relationship and spit out the results I’m looking for.
My man…I gotta give you your props! Thank you!
Got a question, is there a way to evaluate for and/or display category information?
For instance, currently my tied entries loop looks like:
{exp:tied_entries
entry_id="{entry_id}"
weblog="campaign"
tie="<campaign"
category="40|43|44|45"
status="Retired"
limit="5"
sort="desc"
}{if "{tied:count}"=="1"}<h3 class="content_heading">Seasonal Programs</h3>
<ul>
{/if}<li class="clearfix"><a href="#"><span><?php echo date("Y", "{tied:entry_date}"); ?> </span>{tied:title}</a></li>
{if "{tied:total_results}"=="{tied:count}"}
</ul>
{/if}{/exp:tied_entries}I’m hoping I can replace the {tied:title} varialbe with my entry’s {category_name}.
I have tested the standard usage of {categories}{category_name}{/categories} not really expecting it to work - and it didn’t.
Any advice?
Thanks
Michael,
Very pleased to hear that the plugin’s being useful. I hadn’t thought of using it to get around the lack of category filter in the related_entries and reverse_related_entries tags.
Adam, I’m hoping I can replace the {tied:title} varialbe with my entry’s {category_name}. I have tested the standard usage of {categories}{category_name}{/categories} not really expecting it to work - and it didn’t. Any advice?
That’ll take a bit of doing, variable pairs, but I see a way through to how it could be done. Will put it on the roadmap, but I wouldn’t expect it to be done within the next couple of weeks.
But it can be done meanwhile by passing the entry_id to an embedded template:
{exp:tied_entries
entry_id="{entry_id}"
weblog="campaign"
tie="<campaign"
category="40|43|44|45"
status="Retired"
limit="5"
sort="desc"
}{if "{tied:count}"=="1"}<h3 class="content_heading">Seasonal Programs</h3>
<ul>
{/if}<li class="clearfix"><a href="#"><span><?php echo date("Y", "{tied:entry_date}"); ?> </span>{embed="site/.cat" entry_id="{tied:entry_id}"}</a></li>
{if "{tied:total_results}"=="{tied:count}"}
</ul>
{/if}{/exp:tied_entries}And do a regular weblog:entries tag in the embedded template to get the categories:
{exp:weblog:entries weblog="campaign" dynamic="off" status="not closed" disable="custom_fields|member_data|pagination|trackbacks" entry_id="{embed:entry_id}"}
{categories}{category_name}{/categories}
{/exp:weblog:entries}That’s a template with a weblog:entries tag per entry though, so it’s not very efficient server-wise.
Oh dear, I can’t get this to work on EE 1.6.8, PHP 5. I have tried disabling all extensions.
I am trying to tie some reverse relationship fields together across a single weblog. In my template I have
{exp:weblog:entries weblog="locations"}
{title}
{exp:tied_entries entry_id="{entry_id}" tie="<location_parent<location_parent"}
{tied:title}
{/exp:tied_entries}
{/exp:weblog:entries}This kicks out the following warnings and errors:
Warning: ksort() expects parameter 1 to be array, null given in /[removed]/plugins/pi.tied_entries.php on line 357
Warning: ksort() expects parameter 1 to be array, null given in /[removed]/plugins/pi.tied_entries.php on line 358
Warning: array_reverse() [function.array-reverse]: The argument should be an array in /[removed]/plugins/pi.tied_entries.php on line 364
Warning: array_reverse() [function.array-reverse]: The argument should be an array in /[removed]/plugins/pi.tied_entries.php on line 365
Warning: Invalid argument supplied for foreach() in /[removed]/plugins/pi.tied_entries.php on line 370
Warning: Invalid argument supplied for foreach() in /[removed]/plugins/pi.tied_entries.php on line 399
MySQL ERROR:
Error Number: 1064
Description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3 ORDER BY d.entry_id' at line 1
Query: 3 ORDER BY d.entry_id ;I poked around in the plugin and the $ropes_id and $ropes_type arrays are not being initialised prior to the ksort function calls which is where the problems begin.
Not that reversing the arrows should create such a mess, but the problem is that your arrow is facing the wrong way in the tie; if it’s a related field, it’s a “>”, if it’s a reverse related weblog, it’s a “<”.
It should work if fix the tie syntax, but the debug option should be able to tell you that, and right now it can’t. Fixing…
At any rate, calling the same weblog is fine.
Luke, I’ve released an update that handles that particular type of tie parameter malformation, which wasn’t getting handled. Download Tied Entries v1.1.1
Got it! Thanks Adam, I realised I hadn’t read the docs properly shortly after I posted - doh! Ta for the update though.
Actually what would be really great is if there were something like a recursive=”yes” option. What I have on this project (and several others actually) is a location hierarchy. Each location has a parent location which establishes it’s position in the hierarchy. In my templates, where I have a page listing stores in South Africa for example, I need to traverse down the tree to pull out all the stores at the child locations within South Africa.
This kind of feature would be super helpful for breadcrumb navigation as well and having searched around, it seems there is no EE addon which offers a recursive query solution. Maybe there is an opportunity for you to broaden the appeal of your addon?
Great! Looking forward to it! Just to provide a use case for the above, this is what I currently have in my sandbox template to get the output we need:
{exp:weblog:entries weblog="locations"}
<h1>This parent is {title}</h1>
<h3>Tied Entries</h3>
<ul>
{exp:tied_entries entry_id="{entry_id}" tie="<locations" limit="10" search:gypsy_parent_location}
<li>{tied:title} (location) > {title}</li>
{/exp:tied_entries}
{exp:tied_entries entry_id="{entry_id}" tie="<locations<locations" limit="10" search:gypsy_parent_location}
<li>{tied:title} (location) > Parent location > {title}</li>
{/exp:tied_entries}
{exp:tied_entries entry_id="{entry_id}" tie="<locations<locations<locations" limit="10" search:gypsy_parent_location}
<li>{tied:title} (location) > Parent location > Parent location > {title}</li>
{/exp:tied_entries}
{exp:tied_entries entry_id="{entry_id}" tie="<branches" limit="10" search:gypsy_parent_location}
<li>{tied:title} (branch) > {title}</li>
{/exp:tied_entries}
{exp:tied_entries entry_id="{entry_id}" tie="<locations<branches" limit="10" search:gypsy_parent_location}
<li>{tied:title} (branch) > Parent location > {title}</li>
{/exp:tied_entries}
{exp:tied_entries entry_id="{entry_id}" tie="<locations<locations<branches" limit="10" search:gypsy_parent_location}
<li>{tied:title} (branch) > Parent location > Parent location > {title}</li>
{/exp:tied_entries}
{exp:tied_entries entry_id="{entry_id}" tie="<locations<locations<locations<branches" limit="10" search:gypsy_parent_location}
<li>{tied:title} (branch) > Parent location > Parent location > Parent location > {title}</li>
{/exp:tied_entries}
</ul>
{/exp:weblog:entries}The weblog names in brackets are hard coded as I couldn’t get {tied:weblog} or {tied:weblog_short_name} to ouput a value.
If we could rather do something like this, that would be totally spectacular:
{exp:weblog:entries weblog="locations"}
<h1>This parent is {title}</h1>
<h3>Tied Entries</h3>
{exp:tied_entries entry_id="{entry_id}" tie="<locations|branches" recursive="yes" recursive_limit="5" limit="10" search:gypsy_parent_location}
{if '{tied:count}' == '1'}<ul>{/if}
<li>{tied:title} ({tied:weblog}) {tied:parents} > {tied:parent_title}{/tied:parents}</li>
{/exp:tied_entries}
{if '{tied:count}' == '{tied:total_results}'}</ul>{/if}
{/exp:weblog:entries}!
I thought this plugin would accomplish what I need to accomplish with reverse related entries.
It would be great to select which relationship field to filter by when using reverse related entries. Right now I have a weblog that has 2 relationship fields that perform different tasks but relate to the same weblog. How do I tell ExpressionEngine to find all reverse related entries by custom field?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.