2 of 10
2
Multi Relation
Posted: 03 December 2006 12:08 PM   [ Ignore ]   [ # 19 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

@Colly: Is this a gallery or weblog relation?  Do you have any other non-default plugins/extensions/modules running on the template?  I’ve found that most of the time when this happens it’s because either the id="” is spelled wrong, there’s a space after the id="” attribute or no entries have been selected for a relationship.  Have you selected a related “item” for the entry your viewing?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 December 2006 12:17 PM   [ Ignore ]   [ # 20 ]  
Grad Student
Avatar
Rank
Total Posts:  95
Joined  07-06-2006

Cheers Mark.

Weblogs, not galleries.
Using Favorites module, ez_rate module, form_helper plugin. Need all of these (super-complex food database site). Can’t disable any as too much data to lose.

Just double-checked again, and id of custom field for relationship is correct, no naughty spaces, and the entry I’m testing has two entries (also tested with one) related to it.

So close to the perfect solution. Even tried it with queries based on Display SQL output - no joy.

 Signature 

Erskine Design: http://www.erskinedesign.com
“Grad student”? - we’ve been here since the start!

Profile
 
 
Posted: 03 December 2006 03:01 PM   [ Ignore ]   [ # 21 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Alright, version 1.0.4 is at the top of the thread.  There have been a lot of questions about {REL /} tags being inserted into peoples code.  THe reason for this is that EE is using the PHP function “call_user_func_array” function which as of PHP5 will pass by reference, but as of PHP4 will not.  So, if you’re running PHP4, which I would guess a lot of you are, you can install the new extension.  Then open up the ext.multi_relationship.php file and follow the instructions in the top of the file.

I’ve copied an pasted the code here for easier copying.

Open your /system/modules/weblog/mod.weblog.php file and find from this line:
    
    
// -------------------------------------------
    // 'weblog_entries_tagdata' hook.

to this line:
    
    
//
    // -------------------------------------------

Replace between those comments with this:

    if (isset(
$EXT->extensions['weblog_entries_tagdata']))
    
{
        
// -- PHP4 Fix For call_user_func_array not passing by reference
        
global $Weblog; $Weblog = $this;
        
// -- End Fix
        
        
$tagdata = $EXT->call_extension('weblog_entries_tagdata', $tagdata, $row, $this);
        if (
$EXT->end_script === TRUE) return $tagdata;
        
        
// -- PHP4 Fix For call_user_func_array not passing by reference
        
$this = $Weblog; unset($Weblog);
        
// -- End Fix
    
}

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 03 December 2006 03:06 PM   [ Ignore ]   [ # 22 ]  
Grad Student
Avatar
Rank
Total Posts:  95
Joined  07-06-2006

Mark - I’m incredibly grateful for your help with this. Its the difference between a happy client tomorrow and an angry one!

 Signature 

Erskine Design: http://www.erskinedesign.com
“Grad student”? - we’ve been here since the start!

Profile
 
 
Posted: 05 December 2006 09:26 PM   [ Ignore ]   [ # 23 ]  
Summer Student
Total Posts:  5
Joined  03-06-2006

First, thanks to all for help with this. I have done a bunch of work with the query module and got this to work—sort of.

{exp:query sql="SELECT title as related_title, url_title as related_url, entry_id FROM exp_weblog_titles
LEFT JOIN exp_relationships ON exp_weblog_titles.entry_id = exp_relationships.rel_child_id
WHERE exp_relationships.rel_id = ‘{Stores}’"}
{related_title}<br>
{/exp:query}

I have a main blog called Products and two related blogs called stores and brands. This is running on Products page and I am trying to link over to the associated stores.

My problem with the above query is that it’s only returning the first item in the multi-list. Could anyone explain how to get the query to pick up everything in the multi-relationship list?

Thanks again.

--Scott

Profile
 
 
Posted: 06 December 2006 09:16 AM   [ Ignore ]   [ # 24 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

@bshersey: Is there a reason that you don’t want to just use the {related_entries /} tag?  It seems to me you’re trying to recreate that, only your way won’t have the built in caching that the {related_entries /} tag provides.  Also, what is the {Stores} tag.  Is it a multi-relationship?  If so then you’ll need to use some PHP to convert the return delimited list into a comma delimited list and then place that in a MySQL ‘IN’ statement like so:

rel_id IN (<?php explode(",", preg_split("/[\r\n]+/", "{Stores}")); ?>);

Of course doing it this way also requires PHP’s parsing stage to be set to input so it can run before the EE Template class does.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 06 December 2006 09:52 AM   [ Ignore ]   [ # 25 ]  
Summer Student
Total Posts:  5
Joined  03-06-2006

Hi Mark,

Thanks for your response. To answer the questions…

1.) Yes, it is using your multi-relationship extension. I keep getting those gibberish responses whenever I use the {related entries} tag. I have upgraded to your newest build. I haven’t checked, however, to see what version of PHP is being used. It is a pMachine-hosted site, so I assumed it was the latest. But I have not checked. So I tried to do it with the query.

2.) The main blog is Products. It calls sub-blogs Stores and Brands using your multi-relationship extension. {Stores} is the field I use in Products to call the content from the Stores blog. BTW, if I simply call {Brands} or {Stores}, it delivers IDs to me. The numbers seem to correspond with the number of items I have picked from each multi-relationship field in the main blog. But I haven’t tried to break them up.

3.) I did notice that no matter how I called the information, it was giving me multiple numbers as a single list/string. I assumed I had to break it somehow, but I am not a PHP expert. So thanks for the code sample.

However, it seems like if I can make the {related_entries} tag work, it would be easiest.

Thanks again,

--Scott

Profile
 
 
Posted: 04 January 2007 05:19 PM   [ Ignore ]   [ # 26 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  111
Joined  12-29-2004

Mark, is there any way to set the order for the related entries using this extension? I think right now it uses the order set via the custom field configuration which only allows for title and date, but I’d like to sort the output by a custom field.

Example:

{related_entries id="my_field" order_by="my_custom_field"}
{my_custom_field}
{
/related_entries}

I guess the other way would to throw everything in a php array and sort it that way but I thought I’d ask. Thanks!

 Signature 

imagehat studio
the forum user formerly known as lavalamp

Profile
 
 
Posted: 12 January 2007 10:31 AM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1457
Joined  03-26-2006

I’m just upgraded to 1.0.4 and have found that clicking “Quick Save” loses the settings for the mutil-relationship area. Is this a bug? I was also having this problem in 1.0.1, which I was using until this morning.

Also, I’m on PHP 5. I tried adding that tweak you mentioned to the mod.weblog.php file because the server on which this site will reside when live is definitely running PHP 4, but get an error:

Fatal error: Cannot re-assign $this in /Users/me/Sites/mysite/system/modules/weblog/mod.weblog.php on line 2801

Does this tweak NOT work on 5? If so, will I have to make this change to that file once I go to the live server? Thanks for your help - this extension really has saved me on my current project. Wish I could get the setings to stick when clicking “Quick Save”, though!

 Signature 

ryan masuga
Masuga DesignMember, EE Pro Network
Peruse my EE Plugins & Extensions

Profile
 
 
Posted: 22 January 2007 04:27 PM   [ Ignore ]   [ # 28 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1457
Joined  03-26-2006

Sorry to “bump” this, but the client just started updating the products on the dev site and found that all the multi-relation entries were forgetting themselves - and it turns out it was because they were indeed using the Quick Save button. I told them to click “Update” instead for right now.

Is this a known problem? I really need to use this extension on that particular site - I’m not sure how I will complete that site without it!

 Signature 

ryan masuga
Masuga DesignMember, EE Pro Network
Peruse my EE Plugins & Extensions

Profile
 
 
Posted: 22 January 2007 04:52 PM   [ Ignore ]   [ # 29 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  398
Joined  10-10-2004

Mdesign: You could always remove the “quick save” button using this extension.

Profile
 
 
Posted: 22 January 2007 05:07 PM   [ Ignore ]   [ # 30 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1457
Joined  03-26-2006

I know I can disable it - but I and my client ACTUALLY like quick save. I know a lot of people can’t stand it, but I don’t understand why. If you’re working on a draft, and you have a big content area with a lot of HTML or Textile formatting - it allows you to make incremental tweaks and keeps you right there, on the entry, to keep tweaking. I know it’s only saving a click each time (after hitting update, you then click on “Edit this Entry” on the next screen...) but I find saving a click to be handy and a wee bit faster (because I always have at least two tabs open, or two windows, with the admin area in one, and the live/or dev site in the other). Make a tweak, hit quick save, switch to other window, refresh. Repeat until perfect.

I just think, instead of installing two extensions to make one work right - the one should work right!

 Signature 

ryan masuga
Masuga DesignMember, EE Pro Network
Peruse my EE Plugins & Extensions

Profile
 
 
Posted: 23 January 2007 01:25 PM   [ Ignore ]   [ # 31 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1457
Joined  03-26-2006

#$(*&^#$ - I just lost a really long post trying to spell check the damn thing. ARRGH.

ANYWAY - briefly, this extension is also losing settings when another unrelated but required field is not filled in and EE throws an error.  So - this doesn’t appear to work with quicksave, and it doesn’t appear to work when EE throws an error (i.e. for a required field).

Questions:

Is anyone else using this, and experiencing these same issues? If you are not using this, how are you managing your relationships? I’d like to get this resolved on some level before going too far along with the build of this site.

Thanks.

 Signature 

ryan masuga
Masuga DesignMember, EE Pro Network
Peruse my EE Plugins & Extensions

Profile
 
 
Posted: 13 February 2007 10:24 PM   [ Ignore ]   [ # 32 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  361
Joined  11-19-2003

Is there a way to be able to generate the list of “related entries title” from more than one weblog ?

Profile
 
 
Posted: 23 February 2007 10:44 AM   [ Ignore ]   [ # 33 ]  
Grad Student
Rank
Total Posts:  63
Joined  02-23-2007

Can anybody tell me how to integrate this into SAEF?

Profile
 
 
Posted: 27 February 2007 10:23 PM   [ Ignore ]   [ # 34 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  321
Joined  08-22-2005

Mark:
I just wanted to drop by and tell you thanks for the multi relationship extension. I appreciate the hard work you have done on these extensions.

 Signature 

Thanks,
Eric

I think all extremists should be shot!

Profile
 
 
Posted: 05 March 2007 01:26 AM   [ Ignore ]   [ # 35 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  06-12-2002

Mark & co.,

It’s worth noting that the odd {REL} behavior apparently sometimes happens even if you ARE running PHP 5—i’m on 5.2.1, and had the same issue.

However, your fix to mod.weblog works for me too! Just thought i’d contribute that you might try the fix even if you’re NOT on PHP 4, if you’re having the issue!

Adrienne Travis

Profile
 
 
Posted: 05 March 2007 10:59 PM   [ Ignore ]   [ # 36 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  321
Joined  08-22-2005

Bug Report:

I have Weblog A (classes) and it relates to Weblog B (teachers).

I deleted a teacher from the weblog “teacher”. This teacher that I deleted was connected to a class in the “classes” weblog. When I listed the class the teacher still showed up even though they had been deleted. I had to go in and do an edit on that class to “break” or remove the linking.

Is there a setting that I need to explore or is this a bug?

 Signature 

Thanks,
Eric

I think all extremists should be shot!

Profile
 
 
   
2 of 10
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 61047 Total Logged-in Users: 12
Total Topics: 73844 Total Anonymous Users: 11
Total Replies: 398319 Total Guests: 383
Total Posts: 472163    
Members ( View Memberlist )
Active Members:    atiosisBart KustersbkuberekBmovieCheifCrucialcschlormanDavid HaighdrpuddingintrokitJake LymanTyssen