Topic: You might be interested in the foloving jobs...
How would be possible to include 'you might be interested in the foloving jobs' - link to 5 or 10 similar jobs or newest from the same category?
Welcome to jobberBase Developer Community!
You are not logged in. Please login or register.
We've just added a new category for forums dedicated to local communities.
If you're interested in starting a community in your country or even city, please write us at hello@jobberbase.com and we'll make it happen.
We're also looking for moderators on each local community -- so email us :).
Pages: 1
How would be possible to include 'you might be interested in the foloving jobs' - link to 5 or 10 similar jobs or newest from the same category?
Hey,
In hireme.sg, i used the following to display similar jobs
page_job.php
Add the following line of code
$smarty->assign('similarjobs', $job->GetJobsByName($info['title'], 10));And in Class.job.php
Add
public function GetJobsByName($jobname = false,$limit = false)
{
global $db;
if (strstr($jobname, ' ') || strstr($jobname, ' '))
{
$tmp = explode(' ', $jobname);
$kw1 = $tmp[0];
$kw2 = $tmp[1];
if ($kw1 == '')
{
$kw1 = $kw2;
$kw2 = '';
}
}
else{$kw1= '';}
$jobs = array();
$conditions ='';
if ($kw1 !='' && $kw2 !='')
{
$conditions .=' AND title LIKE "%' . $kw1 . '%" OR title LIKE "%' . $kw2 .'"';
}
else
{
$conditions .=' AND title LIKE "%' . $jobname . '%"';
}
if ($limit > 0)
{
$sql_limit = 'LIMIT ' . $limit;
}
else
{
$sql_limit = ''; //Edited by vinay@artminister.com
}
$sql = 'SELECT id
FROM jobs
WHERE 1 ' . $conditions . ' AND is_temp = 0 AND is_active = 1
ORDER BY created_on DESC ' . $sql_limit;
$result = $db->query($sql);
while ($row = $result->fetch_assoc())
{
$current_job = new Job($row['id']);
$jobs[] = $current_job->GetInfo();
}
return $jobs;
}
And in job-details.tpl
Add
{if $similarjobs}
<h2 class="similarjob">You might also be interested in the following jobs</h2>
<ul class="listingjobs">
{foreach item=job from=$similarjobs}
<li><a href="{$BASE_URL}job/{$job.id}/{$job.url_title}/" title="{$job.title}">{$job.title|lower}</a></li>
{/foreach}
{/if}
</ul>
I know its not the best solution, but just a quick one.
regards
vinay
Last edited by flakdesign (2008-08-20 15:15:19)
Fatal error: Smarty error: [in job-details.tpl line 141]: syntax error: mismatched tag {/if}. (Smarty_Compiler.class.php, line 2284) in /home/-httpd/darbadiena.lv/_includes/smarty/libs/Smarty.class.php on line 1088
dont know whats wrong...
Oops, missed an {if} tag, Fixed the code in job-details.tpl
Thanks, now it should be OK, just dont know why it is not showing anything. Anyway, thanks a lot, willl try to hack this.
Small fix. Put the </ul> into the {if} so when there are no similar jobs the closing tag (without opening tag) won't be written and removed {$job.url_title} from the URL, because it is not necessary.
{if $similarjobs}
<h2 class="similarjob">You might also be interested in the following jobs</h2>
<ul class="listingjobs">
{foreach item=job from=$similarjobs}
<li><a href="{$BASE_URL}job/{$job.id}/" title="{$job.title}">{$job.title|lower}</a></li>
{/foreach}
</ul>
{/if}
Last edited by evertsemeijn (2009-02-07 12:37:10)
And how do I prevent the current job from beinging displayed in the list? Because at the moment they do :S
Posts [ 7 ]
Pages: 1
Powered by FluxBB
[ Generated in 0.024 seconds, 7 queries executed ]