Derek, I’ll PM you with the URL. The client believes this is sensitive information. You can show it to whomever you think needs to see.
I can’t upgrade to the latest version; client doesn’t want to at the moment ($). He is on 1.5.0 Build: 20060906. Maybe if the version is an issue I can get him to spring for the upgrade, but I’m not hopeful.
I copied the template group to another group and removed the member permissions so you won’t have to log in. What you’ll see is the administrator version that lists all jobs; logged-in users see only their individual jobs.
The general setup is this: clients are assigned to the ‘clients’ member group, and their username is added to a custom field dropdown list named project_client.
Weblog data is all custom fields (excluding {title}, of course): project_client, project_priority, project_duedate, project_comments, project_notes.
In template ‘table’, I get the list of usernames in the clients member group. {exp:query} loops through results, so for every username, the admin_table template is called, with username and company variables passed.
In admin_table, the query is to extract the posts of the current client, as passed via username in the {embed} statement. The client version of this doesn’t use the query, but the count problem remains. PHP is parse on input.
For every distinct client, the top of the table is output, then the entries tag is used to loop through each entry, looking for an entry where the project_client field matches the current username. If they match, a table row is output.
This is where the problem lies. The {count} variable is incremented every trip through the weblog:entries tag, regardless of whether there is a match or not. It counts loops. I’ve tried putting a PHP variable in and incrementing it, but it does the same thing. I’ve also tried, in the client’s version, setting PHP to parse on output, but it doesn’t increment the variable because the table’s already rendered.
The code.
Index:
{assign_variable:my_template_group="testing123"}
{embed="{my_template_group}/head"}
<title>Van Wyk Design</title>
</head>
<body>
<div align="center">
<div id="centerframe">
{embed="projects/nav"}
{embed="testing123/table"}
{embed="vanwyk/bottom"}
</div>
</div>
</body>
</html>
table:
<div id="projectdiv">
{exp:query sql="SELECT username, screen_name as company FROM exp_members WHERE group_id = '6' ORDER BY screen_name" }
{embed="testing123/admin_table" username="{username}" company="{company}"}
{/exp:query}
</div>
admin_table:
<?php $username = "{embed:username}";?>
{exp:query sql="select entry_id as entryid from exp_weblog_data where field_id_32 = '<?=$username?>' LIMIT 1"}
<table class="projects" width="670" border="0" cellpadding="0" cellspacing="0">
<caption align="top">{embed:company} Project Report</caption>
<tr class="tablehead">
<td width="20" class="name"> </td>
<td width="160" class="name">Name</td>
<td width="100"><div align="center">Priority</div></td>
<td width="90"><div align="center">Due Date </div></td>
<td width="300"><div align="center">Comments</div></td>
</tr>
{exp:weblog:entries weblog="projects" orderby="project_priority|project_duedate|title" sort="desc|asc|asc"}
{if "{embed:username}" == "{project_client}"}
<tr valign="top" class="entry">
<td class="name">{count}</td>
<td class="name">{title}</td>
<td class="priority">{project_priority}</td>
<td class="duedate">{project_duedate format="%n-%j-%y"}</td>
<td class="comments">{project_comments}</td>
</tr>
<tr class="notes"><td colspan="5">Notes: {project_notes}</td></tr>
<tr><td colspan="5"> </td></tr>
{/if}
{/exp:weblog:entries}
</table>
{/exp:query}
So there you have it. I’m at a loss as to what to do; I had to do the setup this way because the client isn’t tech-oriented enough to go through setting up a specific weblog for each client. He wants to do as little as possible, which is add the client as a member. If I took some time to write a plugin that would populate the project_clients field rather than him having to get in and add a name, he would be in seventh heaven. That’s what I’m dealing with.