ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Proxy Error - using MSM

September 11, 2012 4:37pm

Subscribe [1]
  • #1 / Sep 11, 2012 4:37pm

    ladooley

    11 posts

    I’m using MSM to manage two academic lab sites both being hosted on the UCLA server. I’m working from an EE2 non-commercial license.

    In one section of the site, we list a number of researchers that are partners of the lab, along with their bios and photos. Here is the page:
    http://cple.psych.ucla.edu/index.php/cple/researchers

    On this page, the researchers are presented in alphabetical order (by last name). However, I also want to create links on the page that allows users to view the researchers organized by their discipline, as well as a link that allows the user to view by geographical region.

    In the backend, I’m using FF Matrix for the content, with each row being one researcher’s information. Within each row, there is a cell for the researcher’s discipline and another cell for the researcher’s region.

    So I then created a page for the researchers content sorted by discipline, and I used conditional statements to organize the content. Here’s the code:

    {exp:channel:entries channel="researchers"}
     <h1>People: {title}</h1>
     
    {embed='embeds/subnav2'}
    
    <h3>Business</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Business"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Communications</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Communications"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Criminology</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Criminology"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Economics</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Economics"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Law</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Law"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Political Science/Politics</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Political Science/Politics"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Psychology</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Psychology"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <h3>Social Work</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Social Work"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p><h3>Sociology</h3>
    <p> {researchers}<br />
    {if "{discipline}" == "Sociology"}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
    {/if}<br />
     {/researchers}</p>
    
    <p>{/exp:channel:entries}

    However, when I try to preview this page, I get a Proxy Error. Here is the error message:
    Proxy Error

    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request GET /index.php/cple/by-discipline.

    Reason: Error reading from remote server


    It seems to be overloading the server somehow - because when I take off the last conditional statement, the page loads fine - albeit very slowly.

    Is there a way to workaround this? Or to condense/rewrite the code so it doesn’t take so much processing power, avoiding this error?

    Thanks very much in advance.

    Best,
    Larissa

     

  • #2 / Sep 12, 2012 4:51pm

    Dan Decker

    7338 posts

    Hi Larissa,

    UCLA uses ExpressionEngine!? That’s awesome!

    I think a simple rearrangement of your code would make all the difference. You don’t need to repeat or test the condition, just use the field like so:

    {researchers}
    <h3>{discipline}</h3>
    <p><table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
     {/researchers}

    Move the opening {researchers} tag above the H3, and use {discipline} inside the H3 to just display its value. That reduces your entire template to this:

    {exp:channel:entries channel="researchers"}
     <h1>People: {title}</h1>
     
    {embed='embeds/subnav2'}
    {researchers}
    <h3>{discipline}</h3>
    <p><table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
     {/researchers}<br />
    {/exp:channel:entries}

    Much easier to maintain, and it should be much faster.

    Let me know what you think!

    Cheers,

  • #3 / Sep 14, 2012 7:56pm

    ladooley

    11 posts

    Hi Dan! Thanks so much for your reply - sorry for my delayed response, for some reason I didn’t get an email alert that anyone had responded.  And yes, we love EE at UCLA!

    Ok so…I tried your fix, and while it does avoid the proxy error, the result is something slightly different than what I’m looking for:
    http://cple.psych.ucla.edu/index.php/cple/by-discipline-test

    What I’m aiming for is this:
    http://cple.psych.ucla.edu/index.php/cple/by-discipline
    In order to provide you with the above link and have it actually load, I had to take out most of the disciplines - only 2 are displayed there. But this is the setup I’m looking for.

    Basically, I just need to group the researchers by their discipline. (We have one page in which we list all the researchers alphabetically. Then we want to allow users to view the researchers by discipline; and then, on a third page, to view them by geographical region.) So, for this “by discipline” page, what I’d like to have is the name of the discipline as a subheading (eg., Business), and then below that all the bios of all the researchers that fall under that discipline. Then the second discipline (eg., Communications), and then all the bios of the researchers that fall under that discipline.

    What I got instead, using your suggested code, is the discipline name above each person’s bio (instead of just having the discipline name once). Additionally, the researchers weren’t group together by discipline - they were still be ordered alphabetically.

    Hope that makes sense - let me know your thoughts, thank you!!

  • #4 / Sep 17, 2012 4:50pm

    Dan Decker

    7338 posts

    And yes, we love EE at UCLA!

    Excellent!

    What I got instead, using your suggested code, is the discipline name above each person’s bio (instead of just having the discipline name once)

    Ok, some refinements are due then, and should be pretty easy!

    {exp:channel:entries channel="researchers"}
     <h1>People: {title}</h1>
     
    {embed='embeds/subnav2'}
    {researchers orderby="discipline"}
    {if row_count == '1'}
    <h3>{discipline}</h3>
    <p>{/if}<br />
    <table class="people"><br />
    <tbody></p>
    
    <p><tr><br />
    <td class="people_name">{name}</td><br />
    </tr></p>
    
    <p><tr><br />
    <td><br />
    <div class="fltlft">{photo}</div>{bio}<br />
    {if "{website}"}<a href="http://{website}" target="_blank" rel="noopener">Website</a>{/if}<br />
    </td><br />
    </tr></p>
    
    <p></tbody><br />
    </table><br />
     {/researchers}<br />
    {/exp:channel:entries}

    That should tell Matrix to order its entries according to discipline and should only output the discipline once for each group.
    If that isn’t quite it, would I be able to come in for a look? Being able to see how it’s all set up, I could come up with a solution.

    Cheers,

  • #5 / Sep 20, 2012 4:13pm

    ladooley

    11 posts

    Hi Dan,

    Thanks so much for this! It looks like it’s *almost* there.
    http://cple.psych.ucla.edu/index.php/cple/by-discipline-test

    It does appear now to be ordering the researchers by discipline, which is great!

    The only issue now is that the discipline subheading is not appearing for each discipline, only for the first discipline (Business).

    You can certainly have access to the backend of the site - I will PM you the login details now. Thank you!!

    Best,
    Larissa

  • #6 / Sep 20, 2012 4:19pm

    ladooley

    11 posts

    Hi again - I just tried to PM you the login info but it said your inbox is full. If you email me at .(JavaScript must be enabled to view this email address) I can send you the info. Thanks!
    L

  • #7 / Sep 21, 2012 5:56pm

    ladooley

    11 posts

    Any chance anyone can help me get this sorted in the next day or so? My deadline to complete the site is Monday, and this is one of the last things I need to sort out! Anyone anyone?

  • #8 / Sep 24, 2012 12:06pm

    Dan Decker

    7338 posts

    Hi Larissa,

    All apologies for the delay!

    Hi again - I just tried to PM you the login info but it said your inbox is full. If you email me at .(JavaScript must be enabled to view this email address) I can send you the info. Thanks!

    Not full, staff have them disabled for security. I’ll send you the login request and we’ll get in for a look at this.

    Be on the lookout for an email from EllisLab!

    Cheers,

  • #9 / Sep 25, 2012 12:55am

    ladooley

    11 posts

    Hi Dan,
    Thanks for your reply. I got the login request and replied with my info earlier this morning. Let me know if you were able to take a look.
    Thanks again-
    Larissa

  • #10 / Sep 26, 2012 9:33am

    Dan Decker

    7338 posts

    Hi Larissa,

    Indeed, we have your info and Shane and I have been in for a look!

    I’ve come up with about 1/2 a solution, getting all the like disciplines grouped together. The other 1/2 is getting the h3 to only display once for each set.

    Thanks for your patience!

    Cheers,

  • #11 / Sep 26, 2012 9:24pm

    ladooley

    11 posts

    Ok. Is there a better way to organize the content in the backend, that would make this easier? How would you do it, if you were doing this from scratch?
    It would be a hassle to reorganize all the researchers content, since there’s so much of it, but it seems like there might not be a solution with the setup as it is now.
    How would you set it up, given that I need to express the researchers alphabetically, and then sorted by discipline, and then by region?
    The only thing I don’t want is to have to enter all the researcher content three different times for the three different sorts. I’d just want to be able to have one place with all the researcher content, and the three different sorts to pull from there.

  • #12 / Sep 27, 2012 10:46am

    Lisa Wess

    20502 posts

    Hi, Larissa,

    Dan is out today but I wanted to make sure to follow up and answer your question about doing this from scratch.  I’m going to start from your original post and ignore the code since, given your request:

    On this page, the researchers are presented in alphabetical order (by last name). However, I also want to create links on the page that allows users to view the researchers organized by their discipline, as well as a link that allows the user to view by geographical region.

    The way that I would have personally handled this would have been a channel for the researches, with a set of custom fields:

    first_name
    last_name
    discipline
    geo_region

    Each entry in that channel would then be a researcher with those details.

    You could then easily use the channel entries tag with orderby, sort, and even search://, in combination with dynamic_parameters or segment variables alongside some forms or pre-built links on your site to allow your users to limit, sort, or order those entries however they want.

    That is essentially how we handle the location and discipline sorting for our professionals network listing.

    The other option there would have been using that information in combination with something like Solspace’s Super Search for the sorting.

    Does that make sense? Let us know if you have follow up questions - we’re happy to help. 

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases