Let’s see if I can get this across…
I have a design portfolio website I’m building (for myself). It has this structure:
The Main weblog, which reverse relates to seperate weblogs with portfolio entries (one for each type, with the names: port_print, port_web, port_logos, etc). I have one Main entry for each type as well, one called Print (url titled “print”), one called Web, one called Logos, etc. A sort of many to one relationship.
Two of the Portfolio weblogs have a category group attached to them, because I want to display the data for those weblogs differently in the site/portfolio template and categories seemed like the best way. So, for instance, the port_print weblog has Print Categories attached to it (“business card” “letterhead” “postcards” etc). To denote each port_print entry from one another.
So a user clicks on “see the print portfolio” on my menu. It leads to the site/portfolio/print template, filled with data from the Main entry called “Print” (“print” being the url_title of the Main weblog entry I want to access with that link). In the instances of Main weblog entries for Web or Logos, etc, I am simply reverse-relating an iteration of thumbs and links to all the items in the port_web or port_logos weblogs. (Those links lead to a new template, site/details/url_title.)
But in the “site/portfolio/print” entry (which again is of the Main weblog), I want to generate a list of all things in the reverse-related print entry of the port_print weblog, separating out by category, trying to use this wiki method.
So, for the print page, I want to see the following on the site/portfolio:
Category 1 (ie Business Cards)
{reverse_related_entries link to “port_print” weblog field for that category}
-{title} for business A
-{title} for business B
{/reverse_related_entries}
Category 2 (ie Letterhead)
{reverse_related_entries link to “port_print” weblog field for that category}
-{title} for business X
-{title} for business Y
{/reverse_related_entries}
I can get it working, except there seems to be a limit with the use of the {exp:weblog:entries} with {reverse_related_entries}. I can’t limit the reverse relationship to that category only. This is as close as I can get (I’ll leave the code alone for a spell, I have to do a few other things anyway.) There are three entries in my port_print weblog right now. All three show up in both categories that have entries attached. No idea why it’s also duplicating again, putting in a </div> tag and putting the duplicate outside my nice formatting. ![]()
The code that produces this (irrelevant code in another if snipped out):
{exp:weblog:entries weblog=“main”}
—snip—
{if:elseif url_title == "print"}
{exp:weblog:categories weblog="port_print" show_empty="no"}
{category_name}<br />
{exp:weblog:entries weblog="port_print" orderby="date" category="{category_id}" sort="asc" limit="50" dynamic="off" }
{reverse_related_entries id="pagelink" }
<a href="{title_permalink="weblog/comments"}">{pagetitle}</a><br />
{/reverse_related_entries}
{/exp:weblog:entries}
{/exp:weblog:categories}
{/if}
{/exp:weblog:entries}
Any ideas? Impossible? Is there a better way to do this to begin with? I’m willing to do a (limited) amount of restructuring, though the rest of the site works so well right now…I’d hate to change THAT much!
Edit: Another issue is that of course, I tried to use dynamic=“off” in the weblog:entries inside the exp:weblog:categories tag, and that means it shows up on other weblog entries in the same template. Duh. But otherwise, you get just ONE category (not even both of them) to show up, with no related entries listed underneath…
