3 of 11
3
Multi Relation
Posted: 13 March 2007 09:29 AM   [ Ignore ]   [ # 37 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  361
Joined  11-19-2003

I have the weird REL code too.

{REL[51][directors]B94dBcBIREL}{REL[52][directors]B94dBcBIREL}{REL[53][directors]B94dBcBIREL}

Is the solution posted in post #21 the solution for this? I just want to double check before making the changes ...

Profile
 
 
Posted: 13 March 2007 10:12 AM   [ Ignore ]   [ # 38 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

That is correct Ozmodiar.

As always make sure to make a backup copy before making any changes.. just in case smile

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 22 March 2007 11:18 AM   [ Ignore ]   [ # 39 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  307
Joined  01-20-2006

Ack. Accidental Quote. Please delete me.

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 25 March 2007 12:37 PM   [ Ignore ]   [ # 40 ]  
Summer Student
Total Posts:  24
Joined  08-07-2003

I don’t know if this is a bug or something I’m doing wrong, but adding anything to the related_entries tag seems to kill the whole thing.

This works fine:

<ul>{related_entries id="prod_contacts"}
   
<li>{title}</li>
{/related_entries}</ul>

This returns no results (just the ul tags with nothing between):

<ul>{related_entries id="prod_contacts" order_by="loc_sort|title" sort="asc" status="open"}
   
<li>{title}</li>
{/related_entries}</ul>

It doesn’t matter which parameters are in there - I’ve tried using only one parameter, only one sort field, etc…any parameters at all mean I get no results.

Profile
 
 
Posted: 27 March 2007 07:53 AM   [ Ignore ]   [ # 41 ]  
Lab Assistant
RankRank
Total Posts:  239
Joined  12-06-2002

Multi Relation saves the day (again)... now, has anyone come up with a way of counting how many entries are related??? Specifically, I want to create a conditional with different output based upon if there’s a single related entry, two related entries or more than two.

Profile
 
 
Posted: 29 March 2007 11:05 AM   [ Ignore ]   [ # 42 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  183
Joined  03-21-2006

Hi,

I have a quick question and bug.  I, like everyone else, got the weird string bug, but changing the code fixed that until I started working with parameters in the:

{related_entries id="show_images" orderby="random" limit="1"}

Then I get the gibberish again with the parameters in the string.  I need to have the client be able to select multiple images but only show one at a time to give a rotating image look every time the page refreshes.

I am assuming that you can not put the parameters in the related entries, but I wasn’t sure of another way to get this to work.

Thanks,
Seth

 Signature 

http://www.sethaldridge.com/

Profile
 
 
Posted: 11 April 2007 09:23 AM   [ Ignore ]   [ # 43 ]  
Lab Assistant
RankRank
Total Posts:  115
Joined  10-31-2006

I’m having a hard time linking to related entries. The {url_title} variable doesn’t work for me, presumably because the entries I’m linking to are managed by the Pages extension, so their URLs aren’t standard. For example, the static page

http://site.com/internal/depts/dean/business

is related to the static page

http://site.com/internal/policy/credit

Both are in the same weblog, just in different categories. The trouble is that {url_title} outputs

http://site.com/internal/depts/dean/credit

...when invoked from the “business” page. I tried using {exp:static_page_path}{url_title}{/exp:static_page_path} with the same result.

Any ideas?

Thanks,
Ben

Profile
 
 
Posted: 11 April 2007 12:02 PM   [ Ignore ]   [ # 44 ]  
Lab Assistant
RankRank
Total Posts:  115
Joined  10-31-2006

I had to resort to PHP to solve the above problem. Here’s how I did it:

First, at the top of the template (probably anywhere outside of the categories tag, actually), I did:

<?php $site_index = '{path=site_index}'; ?>

That’s because inside the categories loop, site_index seems to have a different meaning; it includes the path to the template plus the category link.

Then, to display the related entries with links:

<h3>Multi Relationship Test</h3>
<
ul>
{related_entries id="nsite_multi_related_test"}
{categories}
<?php
    
// this works in part because we know static pages entries
    // will be in only one category, so this PHP is executed only once
    
global $DB;
    
$cat_tree = '';
    
$page_cat = '';
    
$cat_id = {category_id};
    
$sql = "select cat_description from exp_categories where cat_id=$cat_id";
    
$query = $DB->query($sql);
    
$page_cat .= $query->row['cat_description'];
    do
{
        $sql
= "select parent.cat_id, parent.cat_description from "
             
. "exp_categories as parent, exp_categories as child "
             
. "where child.cat_id=$cat_id and child.parent_id=parent.cat_id";
        
$query = $DB->query($sql);
        if (
$query->num_rows == 1) {
            $cat_tree
= $query->row['cat_description'].'/'.$cat_tree;
            
$cat_id = $query->row['cat_id'];
        
}
    }
while ($query->num_rows == 1);
    
$cat_tree .= $page_cat;
?><li><a href="<?=$site_index.$cat_tree?>">{title}</a></li>
{/categories}
{
/related_entries}
</ul>

It’s important (as noted) that static pages only be assigned to a single category. Since that’s the way Pages works by design, I felt I could rely upon it. So inside the {related_entries} tag, I invoke the {categories} tag pair so that I can get at {category_id}. Then I do a database lookup (actually, a bunch of them) to find its parent, then its parent’s parent, etc., until the query returns no results (at the topmost parent). This gives me a string like “root/directory/subdirectory/”, to which I still need to add the page name itself. Well, this is also a category name, but it’s not a parent, so one final DB->query pulls that in and sticks it on the end. This string, appended to the site_index I fetched back at the beginning of the page load, makes the URL I need.

I’m definitely interested in hearing about ways to do this that don’t require so many database calls. This solution requires (n+1)*m calls, where n is the depth of the linked document and m is the number of related documents. So if I have 10 related links, each of which is 4 levels deep in the category hierarchy, I’m looking at 50 database calls just to build this section. Not cool!

Cheers,
Ben

Profile
 
 
Posted: 13 April 2007 12:06 PM   [ Ignore ]   [ # 45 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  361
Joined  11-19-2003

I use the ext on 2 sites. The mod to remove the REL code as shown below worked on 1 site, but not on the other.

{REL[51][directors]B94dBcBIREL}{REL[52][directors]B94dBcBIREL}{REL[53][directors]B94dBcBIREL}

So, I still get this after modifying my php file as described in a previous post.
What should I check next ?


EDIT: NEVERMIND ... MY BAD! SORRY wink

Profile
 
 
Posted: 14 May 2007 02:00 PM   [ Ignore ]   [ # 46 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  172
Joined  05-15-2004

I AM still getting the weird {REL[colors]Ukr1znuSREL} codes even after performing the modification. Odd, that.

 Signature 

AKA Chris Simmons

Profile
 
 
Posted: 14 June 2007 03:30 PM   [ Ignore ]   [ # 47 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1076
Joined  01-24-2006
Jacob Fentress - 30 November 2006 07:33 AM

Chris,

I believe you can already unselect entries. If you only have one entry selected (and if you have multiple, click on one to unselect the rest), then hold ctrl (command on mac) and click on that one selection to unselect it.

When you don’t have any entries selected, you can use something like:

{if products != ""}

to check if the field is empty or not. Of course my field in this case is named “products.”

I hope that helps.

Jacob,

I used:

{if blog_related_posts != 0}
    
<ul>
      
{related_entries id="blog_related_posts"}
      
<li>{title}</li>
      
{/related_entries}
    
</ul>
    
{/if}

to test if there was no entries. This also removed the {rel} gibberish which was outputted if there was no related post.

So my little widget looks like:

<ul>
  
{exp:weblog:entries weblog="blog" disable="" }
  
<li>{title}
    {if blog_related_posts
!= 0}
    
<ul>
      
{related_entries id="blog_related_posts"}
      
<li>{title}</li>
      
{/related_entries}
    
</ul>
    
{/if}
  
</li>
  
{/exp:weblog:entries}
</ul>

 Signature 

VOTE FOR LG Addons in the Mashable Open Web Awards!


Newism - Newcastle Web Design & Development


LG Better Meta now w/ Sitemap Meta & XML Generator | LG Polls | LG .htaccess Generator

Profile
 
 
Posted: 15 June 2007 11:22 PM   [ Ignore ]   [ # 48 ]  
Lab Assistant
RankRank
Total Posts:  140
Joined  05-02-2007

Any word on the incompatibility of this with Quick Save?  That makes it a non-starter for me.

Profile
 
 
Posted: 17 June 2007 12:40 PM   [ Ignore ]   [ # 49 ]  
Lab Assistant
RankRank
Total Posts:  140
Joined  05-02-2007

Nevermind—I took a look at the extension code and EE core code and I see why it doesn’t work and can’t possibly work.

Profile
 
 
Posted: 25 June 2007 08:07 AM   [ Ignore ]   [ # 50 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1726
Joined  03-26-2006

Are we totally sure it isn’t possible? Would be nice to have it work, that’s for sure.

I had a short conversation with Mark H. in January ‘07 in which he seemed to indicate that it would be possible to rewrite multi-relation to work with quick save. When he had time. Which I’m sure he doesn’t have much of. smile

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 25 June 2007 03:26 PM   [ Ignore ]   [ # 51 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  768
Joined  03-16-2002

Just for reference:
If getting the weird {REL[colors]Ukr1znuSREL} codes after updating to EE 1.6.0, be sure to re-apply the hack to mod.weblog.php as mentioned by Mark at the top of the extension file. Works without any change with 1.6.0.

-Markus

Profile
 
 
Posted: 26 June 2007 12:38 AM   [ Ignore ]   [ # 52 ]  
Lab Assistant
RankRank
Total Posts:  140
Joined  05-02-2007
mdesign - 25 June 2007 08:07 AM

Are we totally sure it isn’t possible? Would be nice to have it work, that’s for sure.

Well, Mark would obviously be the authority.

I looked at the code and it seemed to me that it would be impossible for it to work with Quick Save because Multi Relationship stores its data using the ‘submit_new_entry_end’ hook, and as far as I can tell, that hook is never invoked on a Quick Save.  It seemed to me that it might be possible, using ‘submit_new_entry_start’, to make it work when updating an entry, vs. creating a new entry.  I believe the only reason Multi Relationship needs to wait for ‘submit_new_entry_end’ to store the data is so that it has the entry_id, but for existing entries I think you could get the entry_id at the time of ‘submit_new_entry_start’.

Profile
 
 
Posted: 02 July 2007 09:05 AM   [ Ignore ]   [ # 53 ]  
Lab Assistant
RankRank
Total Posts:  114
Joined  01-30-2007

Just for reference:

I get the following error with this extension in ee 1.6:

Undefined variable: field_type in [path to system here]/cp/cp.publish_ad.php on line 7197[ish]

I notice that the solution is here:

http://expressionengine.com/forums/viewthread/38843/#181791

And that obviously, it’s still a potential problem.

For me though it appeared when the multi relationship was added as the first custom field for a paticular weblog. Once I added others, the error message disappeared.

 Signature 

BridgingUnit | Twitter: MarmaladeToday
Search pagination plugin

Profile
 
 
Posted: 02 July 2007 12:09 PM   [ Ignore ]   [ # 54 ]  
Grad Student
Avatar
Rank
Total Posts:  58
Joined  02-02-2006
alienne - 05 March 2007 12:26 AM

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

I never had this issue running PHP 5 (5.2.2) before upgrading to EE 1.6.0. After upgrading, I tried this fix, but it caused me to receive a blank page.

The only way I could fix it was to change my server to use PHP 4 and apply the hack.

Is there any way to get this extension to work on PHP 5 using EE 1.6.0?

Thanks in advance.

Profile
 
 
   
3 of 11
3
 
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 09:33 AM
Total Registered Members: 64914 Total Logged-in Users: 20
Total Topics: 81866 Total Anonymous Users: 12
Total Replies: 440122 Total Guests: 194
Total Posts: 521988    
Members ( View Memberlist )
Newest Members:  smilepolitelyrvmcleodbjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkey