Hi all,
I’ve been trying to get a page working for our client that allows for sorting of results based on 2 relational fields and 2 custom fields. I’ve got a system that seems to be working via our developer, who is pretty fantastic with PHP, but is relatively new to EE. As a result, the system that he has sometimes seems to work, but whenever I make any change to the database, I get the above error in the title. This repeats for every last bit of info the php is trying to grab.
The URL is: http://pattersonsheridan.com/ee/index.php/attorneys (Note: The error doesn’t show up after about 20 minutes after the change. Could this be a clue as to what I need to tweak/adjust?)
<?php
{exp:weblog:entries weblog="attorney" orderby="last_name" sort="asc"}
$name = "{title}";
$roles["{job_title}"][] = $name;
{related_entries id="office"}
$offices["{city}"][] = $name;
{/related_entries}
{attorney_practice_area}
$practice_areas["{exp:replace find="&" replace="&"}{title}{/exp:replace}"][] = $name;
{/attorney_practice_area}
{/exp:weblog:entries}
foreach ($roles as $role => $rpeople) {
$roles[$role] = array_unique($rpeople);
}
ksort($roles);
ksort($practice_areas);
ksort($offices);
?>
<div id="attorneys" class="content">
<h2 class="tg">Attorneys</h2>
<form id="attorneySearch" method="post" action="?">
<select name="office" id="officeSelect">
<option value="">Office</option>
<?php
foreach ($offices as $office => $people) {
echo '<option value="'.$office.'"';
if ($office == $_REQUEST['office']) { echo ' selected="selected" '; }
echo '>'.$office.'</option>';
}
?>
</select>
<select name="practice" id="practiceSelect">
<option value="">Practice</option>
<?php
foreach ($practice_areas as $practice_area => $people) {
echo '<option value="'.$practice_area.'"';
if ($practice_area == $_REQUEST['practice']) { echo ' selected="selected" '; }
echo '>'.$practice_area.'</option>';
}
?>
</select>
<select name="title" id="titleSelect">
<option value="">Title</option>
<?php
foreach ($roles as $role => $people) {
echo '<option value="'.$role.'"';
if ($role == $_REQUEST['title']) { echo ' selected="selected" '; }
echo '>'.$role.'</option>';
}
?>
</select>
<select name="letter">
<option value="">Last Name</option>
<?php
if ($_REQUEST['letter'] != '') {
echo "<option selected=\"selected\" value=\"".$_REQUEST['letter']."\">".$_REQUEST['letter']."</a>";
}
?>
<option value="A">A</a>
<option value="B">B</a>
<option value="C">C</a>
<option value="D">D</a>
<option value="E">E</a>
<option value="F">F</a>
<option value="G">G</a>
<option value="H">H</a>
<option value="I">I</a>
<option value="J">J</a>
<option value="K">K</a>
<option value="L">L</a>
<option value="M">M</a>
<option value="N">N</a>
<option value="O">O</a>
<option value="P">P</a>
<option value="Q">Q</a>
<option value="R">R</a>
<option value="S">S</a>
<option value="T">T</a>
<option value="U">U</a>
<option value="V">V</a>
<option value="W">W</a>
<option value="X">X</a>
<option value="Y">Y</a>
<option value="Z">Z</a>
</select>
<input type="submit" name="button" id="button" value="Submit" />
<!--
<div id="searchAlphaList"><a href="#a">a</a> <a href="#b">b</a> <a href="#c">c</a> <a href="#d">d</a> e f g h i j k l m n o p q r s t u v w x y z ALL | Reset</div>
-->
</form>
<table id="attorneyList" border="0">
{exp:weblog:entries weblog="attorney" orderby="last_name" sort="asc"}
<?php
if (
($_REQUEST['office'] == '' or in_array("{title}", $offices[$_REQUEST['office']])) and
($_REQUEST['practice'] == '' or in_array("{title}", $practice_areas[$_REQUEST['practice']])) and
($_REQUEST['title'] == '' or in_array("{title}", $roles[$_REQUEST['title']])) and
($_REQUEST['letter'] == "" or strtolower(substr("{last_name}", 1, 1)) == strtolower($_REQUEST['letter']))
) {
?>
<tr>
<td>{if prefix != ""}{prefix} {/if}<a href="http://{site_url}index.php/attorneys/detail/{url_title}">{title}{if suffix != ""}, {suffix}{/if}</a></td>
<td>{job_title}</td>
{related_entries id="office"}<td>{if city != "Taipei 106"}{city}{if:else}Taipei{/if}</td>{/related_entries}
</tr>
<?php
}
?>
{/exp:weblog:entries}
</table>Also, for reference, I’ve attached a screenshot of the attorney page, which all content should be pulled from, in case I’ve got something wrong here, as well as a screenshot of the error page in question.
Thanks in advance if anyone has suggestions/ideas on what I’m doing wrong!