With Expression Engine I need to show the other available jobs when on a jobs page. Jobs are either contract or permanent, and on the jobs page I need to only show other jobs of the same type.
The following prints all the other jobs as well as their type:
{exp:channel:entries channel="jobs" dynamic="no"}
<p>{title}
{job_type}</p>
{/exp:channel:entries}
This would print all contact jobs only:
{exp:channel:entries channel="jobs" search:job_type="Contract" dynamic="no"}
<p>{title}
{job_type}</p>
{/exp:channel:entries}
So, I tried using the {job_type} field to refine the search results. However with the following I get no results at all:
{exp:channel:entries channel="jobs" search:job_type="{job_type}" dynamic="no"}
<p>{title}
{job_type}</p>
{/exp:channel:entries}
Someone said I needed to use PHP tags, so I tried the following, but it returns all the results:
{exp:channel:entries channel="jobs" search:job_type="<?=$this->EE->input->get('job_type')?>" dynamic="no"}
<p>{title}
{job_type}</p>
{/exp:channel:entries}
How can I achieve what I need? Im new to EE but I would have thought this would be somewhat standard stuff?
Note, the URL structure doesn’t allow me to use url segments to filter results.
Thanks
You can’t nest
{exp:channel:entries}tags, as it leads to variable collisions. You’ll need to use an embedded template for this, and pass the{job_type}value to that template.So within your main
{exp:channel:entries}loop:Then your embeds/job_type template looks like this: