I updated the download at my site as well, which just adds the tweak outlined above. The package for the new version is called “ext.simple_relation_113a.zip”.
Great extension. Nice and simple, just what I need. But I’ve got one problem…
I’m trying to make this work with Leandro’s jQuery lighbox, but for some reason, the extension always returns 2 extra images. For example, if I’m trying to display the 5 most recent images, the lightbox thinks there’s 7 images (even though there’s only 5 on the page), causing the “Next” button to appear on the 5th (and last image), leading to a dead end.
What version of EE are you using? Can you just output the {gallery} variable to your page and look at the source code to see what it is actually outputting?
Hi again. I was wondering if it’s possible to have reverse relationships for galleries? That is, I would like a link on the related gallery category back to the original entry.
I’m just about to update my copy of ext.simple_relation.php to the latest version, and I see you’ve changed the name to ext.md_simple_relation.php.
Can you clarify what that might mean for upgrading? (I’ve used the previous version to set up a lot of relationships, and I don’t want to bork them )
As the extension now has a different name, I’m assuming I’ll have to de-install the first version and reinstall the second, which I fear may lose all my existing relationships. Or should I just rename the second file ext.simple_relation.php?
Les, I would strongly suggest updating, for sure, as that old 1.0.2 version has a lot of old-school check for update stuff in it that will very often cause problems on the CP homepage.
Sorry about the name change, but I should have prefixed it with the ‘MD’ in the first place.
This is what I would do.
1) Make a quick backup of your DB.
1a) Note all the custom fields you have that are currently Simple Relation Fields.
2) Disable/uninstall Simple Relation.
3) Install/enable MD Simple Relation.
4) Go through your custom field groups setting the custom fields that were SR (and may now be showing as blank) to MD SR.
You should be good at this point. May take you a couple minutes, but should be relatively painless. Uninstalling the first version of the extension shouldn’t do anything to the data in the field - and those fields are only storing a simple number (which was all I wanted).
Hi again. I was wondering if it’s possible to have reverse relationships for galleries? That is, I would like a link on the related gallery category back to the original entry.
Sorry, I was unsubscribed to this thread. You could do this with the query module. Get the gallery id, then use the query module to…ACTUALLY you could probably use a simple embedded template that has a weblog entries tag in it - and then just pass the gallery ID to the search parameter of the embedded weblog:entries tag through an embed variable.
I’ll bet that would work like magic. Did that make sense?
Thanks for the reply. I couldn’t get the embedded template method to work, presumably because the weblog search parameter only works with standard custom fields, but I’ve taken a stab at running a query.
{exp:query sql="SELECT entry_id FROM exp_weblog_data WHERE field_id_13 = 5"} <span class="small"><a href="/films/{entry_id}/">« Return to title</a></span> {/exp:query}
The only problem is that I’m not quite sure how to grab the particular category id.
Think you could post a copy of 1.0.2 for download? I accidentally borked the upgrade and it looks like I’ll need the old version to get back into my EE Control Panel.
Ryan, this is an awesome extension - exactly what I need, with one minor exception! I can’t get it to work in a SAEF.
Do you, or perhaps someone else, know if this is possible or how I’d go about hacking things to make MD Simple Relation work in a SAEF?
Doh! Maybe I can have a look-see at it this weekend. Question: are you using this in the default SAEF, between the {custom_field} tag pairs, or are you hard coding your custom fields?
Yes, using the default between the {custom_field} tags - the label shows up, but no input field at all.
I have not tried hard coding it, you think that could work?
Wow, I just tried monkeying with this on a SAEF and got nowhere. SAEFs are tough, with custom field types. The problem with Simple Relation is that the field type is “simplerel”, so the SAEF doesn’t know what to do with it.
The closest I did get was trying to hack /system/modules/mod.weblog_standalone.php. I was attmpting to replicate the ‘rel’ field type. That was not pretty.
The next thing to try - and this may not work for you - it to manually do the custom fields. That may not be cool, because that might require a bunch of PHP on the template, with a custom query, to get the contents of the pulldown, etc etc.
To be honest, I don’t worry about SAEFs much because I don’t use them, myself.
I did just put this extension in a public repo on GitHub tonight: MD Simple Relation at GitHub. So, if anyone wants to take a stab at maybe using another extension hook to get this thing to work in a SAEF, then go ahead and fork it, and best of luck to you in doing so. If you get it to work, send me a Pull Request and we’ll fix this thing up right.
Thanks for giving it some effort Ryan. I generally don’t use SAEFs either, but in this case I need it because what I’m doing is creating a business directory where companies can login publicly and request inclusion. The businesses are stored in a weblog, and then related to a location (another weblog) as well as categorized by service/product type, hence the need for your extension.
I would not know enough PHP to pull off anything custom, but do you think this might work: manually coding the custom_fields in the SAEF and doing a call to the weblog entries for ‘location’ with the value for each option being entry_id?
On the very rare occasions that I’ve used a SAEF, I’ve always manually done the fields. It’s a little more work, but much more flexible that way.
You could do all your fields manually, and for the Simple Relation field do a custom query, just as you suggested. This may be the way to go. You could lift the query right out of the extension, and hardcode the values in there for the field you’re on (to replicate what your settings for the custom field in the CP).