This is probably the most straightforward way to do this.
It’s actually not that hard - it’s just a matter of determining if you have the two templates connected and then making sure the right value is getting passed.
The best thing to do in “not working” cases is simplify.
In the embedded template - strip everything out except for just the word “yes”.
Then in the parent loop try just:
{if {count} == {total_results}}
{embed="brand_stimulation/projectsbox”}
{/if}</code></pre>
Run that.
The result here is that you should get the word "yes" once in your loop results.
Not getting it? Then strip it back to just:
<pre><code>{embed="brand_stimulation/projectsbox”}</code></pre>
Still not working? Must be a naming thing - make sure there is a template group called brand_stimulation and a template called "projects box".
Working? Good.
Now try putting the conditional back in place. Not working? Try:
<pre><code>{if count == total_results}
{embed="brand_stimulation/projectsbox”}
{/if}</code></pre>
Working? Now add the embed variable back in. In the parent template (working with Dan's code):
<pre><code>{if {count} == {total_results}}
{embed="brand_stimulation/projectsbox” pass_category="{xcategory}"}
{/if}
and in the embedded template:
The result here should be just displaying the category id. Not working? Again, must be a naming thing. The name of the variable must match between parent and embedded templates.
Working? Cool. Then try the rest of Dan’s code:
<div id="projectsholder">
{exp:channel:entries channel="projects" paginate="bottom" limit="8" dynamic="no" orderby="title" sort="asc" category="{pass_category}"}
your template code
{/exp:channel:entries}
</div>
Not working? Try replacing the embed variable with a hardcoded value - just to make sure it works that way.
Again, when something doesn’t work simplify back until it does work then add complexity slowly and incrementally.