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

Multi Relation

Development and Programming

Jörg Gudehus's avatar
Jörg Gudehus
7 posts
16 years ago
Jörg Gudehus's avatar Jörg Gudehus

I was looking for a fast way to link some photos in a gallery to a weblog entry. I am very happy with EE but its a shame that this doesn’t work out of the box. The multirelation extension was the first I found. Can I use playa to link galleries?

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

I wrote an extension that can link a gallery to a weblog entry called MD Simple Relation. Maybe that can help you? It’s not a multiple relation, but you can link to a gallery category, and then use the gallery entries tag to output what you need. Not sure that’s what you need, but it might help you in this case.

       
Jörg Gudehus's avatar
Jörg Gudehus
7 posts
16 years ago
Jörg Gudehus's avatar Jörg Gudehus

That was what I needed. A relation to a category in a gallery and I can use all of the gallery features and tags. How easy. I just had to make some categories and linked them. Thank you.

       
webprouk's avatar
webprouk
69 posts
16 years ago
webprouk's avatar webprouk

Same problem here, I get these errors instead of the relations:

{REL[9][related_files]fsClTvgWREL}
{REL[7][related_files]fsClTvgWREL}
{REL[8][related_files]fsClTvgWREL}

My code:

{related_entries id="related_files"}
           Related files:<a href="http://{file_path}">{name}</a>
           {/related_entries}<br>

Please help Thanks!!!

Sorry, I found the post with the solution :D

       
magder's avatar
magder
24 posts
16 years ago
magder's avatar magder

We are using Multi Relationship extension (v.1.0.6) with ExpressionEngine v1.6.2 and are very pleased with it.

Suddenly about a week ago, after doing some custom edit field editing from the Control Panel (changing a label, switching the order of some custom fields in a field group, etc.) the Edit Custom Field page shows no data for any custom field, just the Submit button and footer.

http://www.oursite.com/index.php?S=0&C=admin&M=blog_admin&P=edit_field&field_id=619

The Add Custom Field still displays fine, and the Multi Relationship option shows properly in the Field Type select box.

We identified that the problem to be a line in method edit_custom_field in the file ext.multi_relationship.php that performs a preg_replace to add the option tag html at the correct location in the page.

$r = preg_replace("/(<select.*?name=.field_type.*?value=.select.*?[\r\n])/is", "$1<option value=\"".$this->type."\"$selected>".$this->name."</option>\r", $r);

Documentation states that in PHP 5.2, preg_replace returns NULL when it has an error, even if the match is found successfully. Perhaps we are exceeding the recursion limit, see posting http://lists.netfielders.de/pipermail/typo3-team-core/2008-January/012297.html

I wrote a fix in the method edit_custom_field that replaces the invocation of preg_replace with a series of preg_match commands that locate the offset of each successive substring that we want to locate: (first “select”, then “name.field_type”, then “value=.select”, then “\n”) and then does a substr_replace to insert the new html “<option > … <option>”.

$pos1 = strpos($r, "select");
preg_match('/name=.field_type/is', $r, $matches_ft, PREG_OFFSET_CAPTURE, $pos1);
$pos2 = $matches_ft[0][1];
preg_match('/value=.select/is', $r, $matches_v, PREG_OFFSET_CAPTURE, $pos2);
$pos3 = $matches_v[0][1];
$pos4 = strpos($r, "\n", $pos3);
$r = substr_replace($r,"<option value=\"".$this->type."\"$selected>".$this->name."</option>\n",$pos4, 0);

With that fix, the Edit Custom Field page in the Control Panel displays fine.

       
bromtec's avatar
bromtec
31 posts
16 years ago
bromtec's avatar bromtec

INSTALLING PLAYA FIXED A PROBLEM WITH MULTI RELATION

I’m sure there is a perfectly logical explanation for this, but I just wanted to post this solution for anyone else in need.

I have 2 sites deployed via MSM 1.1 - both sites are 1.6.6.

One site works great with the multi-relation extension, and the related entries tag is broken on the other site - it simply doesn’t display anything in the simplest of templates.

Upon installing the Playa extension, my problem was fixed. Don’t know why, but it’s working.

I saw someone else post something very similar, but just wanted to add another post, as this one has become several pages long.

       
summitpr's avatar
summitpr
24 posts
16 years ago
summitpr's avatar summitpr

Is there a way to make the multi-relationship field search-able? I have compared this extension to the Playa extension and this one seems to work better with the reverse entries which is important to my project, but the playa extension is searchable.

Playa saves something like this “[rel_id] weblog_title” with the weblog entry. This technique appears to make the weblog entry search-able with the related data.

I hope that makes sense, if not I would be more than happy to try to provide more info. I would love to make the multi-relationship fields search-able!

       
joost de keijzer's avatar
joost de keijzer
10 posts
16 years ago
joost de keijzer's avatar joost de keijzer

Hi,

Trying this extention on EE 1.6.7 and Multiple Site Manager, I found a problem with “normal relationships” and Multi relations on the MSM sites (site_id > 1).

Could it be that Multi Relation is not MSM compatible?

I did the following changes to the php and found it to work correctly now, but I guess some extra testing is needed…

//ext.multi_relationship.php
// around line 455
function modify_template( $tagdata, $row, &$weblog )
{
    // added $PREFS and $site_id
    global $DB, $FNS, $TMPL, $EXT, $PREFS, /*$all_fields,*/ $Weblog;
    $site_id = $PREFS->ini('site_id');

// snip //

// around line 468
    foreach($TMPL->related_data as $key => $rel_data)
    {
        // replaced cfields[1] with cfields[$site_id] (2x)
        if(!isset($$reference->cfields[$site_id])) continue;

        $field_id = $$reference->cfields[$site_id][$rel_data['field_name']];

// done
// rest of code...

Maybe this also explains why enabling Playa helps?

       
erutan's avatar
erutan
6 posts
16 years ago
erutan's avatar erutan

After skimming through the thread I thought I’d just try 1.06 with EE 1.67 (pretty vanilla install, a few modules but no other extensions at this point as I’m still learning my way around) and it seems to be working fine as long as I don’t feed any parameters in it. sort=”asc” would be nice. I deleted the normal relationships I set up earlier, and I don’t have MSM. I’ll update this if anything changes.

This could be a quick/dirty way around descending order: http://www.wrichards.com/blog/2009/02/jquery-sorting-elements/

I do agree that this should be covered in the documentation, as one of the main reasons I chose EE was the integration of custom fields in the core (unlike cck for drupal) and built in relationships to keep things simple. Hopefully 2.0 will have this cooked in.

       
Matt Stein's avatar
Matt Stein
110 posts
about 16 years ago
Matt Stein's avatar Matt Stein

First, thanks Mark for another great and incredibly-useful extension!

I’ve modified v1.0.6 to include Leevi’s MSM-friendly fixes and to use a scrolling DIV with checkboxes rather than a multi-select field. The vertical size of the scroll area is determined by the textarea rows in the field settings.

It seems to be testing just fine with EE 1.6.7+MSM, but I don’t want to post anything without Mark’s permission.

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
about 16 years ago
Matt Weinberg's avatar Matt Weinberg
It seems to be testing just fine with EE 1.6.7+MSM, but I don’t want to post anything without Mark’s permission.

Looks like a cool modification– nice work!

Mark hasn’t posted in quite a while– maybe try contacting him via his site? http://docs.markhuot.com/

Also, have you seen Playa?

Edited to not come off as so negative!

       
Matt Stein's avatar
Matt Stein
110 posts
about 16 years ago
Matt Stein's avatar Matt Stein

Thanks! I’ve come across Playa several times before, but I think I’m about ready to give it a serious shot. Multiple content relationships in EE are never quite as easy as I’d like, so I’m hoping Playa is exactly the thing I’ve been looking for.

       
james Brown's avatar
james Brown
492 posts
about 16 years ago
james Brown's avatar james Brown

No, it is very easy in EE… just use Playa!

Seriously though, it is an excellent extension. It was very easy to implement. I haven’t tried the 2.0 version. It looks like he charges for it now. But I think it is worth the expense.

       
mahalie's avatar
mahalie
60 posts
about 16 years ago
mahalie's avatar mahalie
Same problem here, I get these errors instead of the relations:
{REL[9][related_files]fsClTvgWREL}
{REL[7][related_files]fsClTvgWREL}
{REL[8][related_files]fsClTvgWREL}
My code:
{related_entries id="related_files"}
           Related files:<a href="http://{file_path}">{name}</a>
           {/related_entries}<br>
Please help Thanks!!! Sorry, I found the post with the solution :D

I’m having the same issue, have read the threads and tried clearing cache, reassigning relationship. FWIW multi-relation was working fine for my site for months (PHP 5, EE 1.6.4) until I upgraded the Solspace Tag module (ran the update script).

What was the post with the solution?

I’ll be investigating Playa but need to get the existing site working again in the meantime.

Many thanks!

UPDATE: Playa is great but it will still take some time for me to migrate all our previous entries to the new form. In the meantime I’ve found that clearing the CACHE works, but I have to do it after almost every single update.

       
mixmaster's avatar
mixmaster
1 posts
15 years ago
mixmaster's avatar mixmaster

This is a nice extension, but I also need to relate a category to multiple gallery images. Is this possible? Thanks.

       
First 11 12 13 14

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.