We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extension: MD Simple Relation. Creates a "simple" relationship field, storing only the entry_id.

Development and Programming

Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Wow, yikes. Let me take a look and see what I might have royally screwed up!

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

OK, there was definitely a typo in there - which I fixed. Replace version 1.1.2 with 1.1.3, which you can get from the MD Simple Relation page.

       
Luke Hardiman's avatar
Luke Hardiman
109 posts
16 years ago
Luke Hardiman's avatar Luke Hardiman

Thanks Ryan, although I’m still getting the clash with LG Htaccess Generator.. maybe I need to look at a new index.php removal method.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

No, this thing works with .htaccess generator, because I’m using both on a site right now. I’ll bet you I uploaded the same file by mistake, but gave it a new version number.

I’ll update the download (again…whoops!), but if you want to do a quick fix, disable the extension, then look at line 25 of ext.md_simple_relation.php, which is probably reading:

if ( ! defined('LG_HG_version')){

And change it to:

if ( ! defined('MD_SR_version')){

then re-enable the extension. That should fix the issue.

The reason that issue exists is because I was using Leevi’s .htaccess Generator extension as a model when I was making updates to this extension, and that was a simple copy/paste error.

       
Luke Hardiman's avatar
Luke Hardiman
109 posts
16 years ago
Luke Hardiman's avatar Luke Hardiman

Excellent, that has done the trick, thanks Ryan

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

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”.

Glad that got is solved!

       
tehlupin's avatar
tehlupin
12 posts
16 years ago
tehlupin's avatar tehlupin

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.

Here’s what I’ve got on the entry page:

{embed="films/gallerylinks" gallery_category="{gallery}"}

And the embedded template:

{exp:gallery:entries gallery="gallery" category="{embed:gallery_category}" orderby="date" limit="4" dynamic="off"}
      {entries}
      {row}
<a href="http://{image_url}" title="{category}">http://www.mysite.com/utilities/phpthumb/phpThumb.php?src=/images/gallery/{custom_field_one}/{filename}&w=115&h=80&q=95&zc=1</a>
      {/row}
      {/entries}
{/exp:gallery:entries}

The lightbox is working perfectly on other parts of the site, so I assume there must be a conflict of sorts. Any help would be greatly appreciated.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

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?

       
tehlupin's avatar
tehlupin
12 posts
16 years ago
tehlupin's avatar tehlupin

No need, I’ve figured it out. Turns out I didn’t put the images in a unqiue div. Funny how you miss the simplest things when you’re sleep deprived. :lol:

Thanks for the response though. 😊

       
tehlupin's avatar
tehlupin
12 posts
16 years ago
tehlupin's avatar tehlupin

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.

       
Les McKeown's avatar
Les McKeown
133 posts
16 years ago
Les McKeown's avatar Les McKeown

Hi Ryan -

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?

Looking forward to any advice, thanks.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

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).

If you need any help, ping me.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.
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?

       
tehlupin's avatar
tehlupin
12 posts
16 years ago
tehlupin's avatar tehlupin

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.

       
CelebrationWeb's avatar
CelebrationWeb
38 posts
16 years ago
CelebrationWeb's avatar CelebrationWeb

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.

       
1 2 3 4

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.