Hey, congrats on getting it to work and thanks for sharing, believe me!
Basically, my solution avoids the relationship table entirely (hence the name “Simple Relation”. It’s really no different than having a text field and entering a number in it manually that ties to another entry’s entry_id - except I supply a handy dropdown complete with titles to look at.
I’ll use it like this:
I have a “portfolio” weblog (parent), and “portfolio_images” weblog (all the children that relate to that parent).
I navigate to a single-entry “portfolio” page. On this page in the sidebar, I need to link to all the entries from portfolio_images, sorted by category (I cannot easily do that with reverse_related_entries, which is why I went to the trouble of making this). So I put this on the template:
{embed="portfolio/_gallerylinks" entry_id="{entry_id}"}
Then, the embedded template, I do the category archive tag that loops through the categories and spits out links to each “child entry’s” image:
{exp:weblog:category_archive weblog="portfolio_images" style="linear"}
{categories}
{exp:weblog:entries weblog="portfolio_images" search:img_rel_proj="{embed:entry_id}"
dynamic="off" status="open" category="{category_id}" orderby="date" sort="desc"}
{if count == '1'}
<h3>{category_name}</h3>
<ul>
{/if}
<li><a href="{img_image}">{title}</a></li>
{if count == total_results}
</ul>
{/if}
{/exp:weblog:entries}
{/categories}
{/exp:weblog:category_archive}
Note the search parameter in the entries tag in the embedded template:
search:img_rel_proj="{embed:entry_id}"
Because all I’m storing is the entry_id, that field is just saying search:img_rel_proj=“3” or search:img_rel_proj=“22” or whatever entry_id gets fed there. See the attached image for the output of the above code.
I think if the related entry was deleted…you would never see the output of this tag on a template for that entry. As far as the CP…lemme see… looks like if I delete a “parent” entry, the children’s dropdown goes back to “None”, which is good, no?
EDIT: Note, this isn’t a multi-select (real basic…I just made it about an hour ago), and if I can polish a couple more things, I’ll release it for sure. Right now you have to open the extension and manually enter some things, but I’m trying to get it to automate that by creating a custom field type instead.
Click thumbnail to see full-size image