Topic: Widget: latest jobs in my city
Is it possible somehow to remake widget and show lets say 10 latest jobs in any choosen city?
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
Is it possible somehow to remake widget and show lets say 10 latest jobs in any choosen city?
yes. read the instructions
I read everything and still couldn't find it. Could anybody tell exactly where to look or just post the instructions here? Thank you!
Hi,
To take last n jobs from a given city, make these additions:
- in _includes/class.Job.php, add the following function (arround line 560):
public function ApiGetJobsByCity($city = false, $limit = false)
{
global $db;
$jobs = array();
$conditions = '';
if ($city)
{
$conditions .= " AND c.name LIKE '%" . $city . "%'";
}
if ($limit > 0)
{
$sql_limit = 'LIMIT ' . $limit;
}
else
{
$sql_limit = '';
}
$sql = 'SELECT j.id
FROM jobs j, cities c
WHERE 1 ' . $conditions . ' AND j.is_temp = 0 AND j.is_active = 1
AND c.id=j.city_id
ORDER BY j.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;
}
-in _includes/class.Api.php, after line 27, add:
else if ($action == 'getJobsByCity')
{
$this->mJobs = $job->ApiGetJobsByCity($params['city'], $params['count']);
}
- in api/api.php, on line 21 add:
case 'getJobsByCity':
$params = array('city' => $city, 'count' => $count, 'response' => $response);
$api = new Api('getJobsByCity', $params, $response);
$api->Display();
exit;
break;
Usage:
http://www.yoursite.com/api/api.php?act
esponse=js
Good luck!
It works like a charm! Thank you very much!
I also started to think if there is a chance that I could list jobs in a particular city not only in a widget but also on the site itself (just like category view)?
I know that something similiar can be achieved by searching for a city name, but unfortunately it doesn't work when some special polish characters are used in a city name, i.e. Łódź - there are no search results.
If somebody has done that, please share the code with us ;-)
Last edited by swoboda (2008-10-12 17:29:27)
Thanks, and it wordks really cool. Except one thing - i dont know wht there is some txt code added after html adress, like "aHR0cDovL3d3dy5zdHVmZi5sdi8=/" - for example in this adress:
http://www.darbadiena.lv/job/2043/proje
mZi5sdi8=/
It is the link from site where latest jobs fom specific category are shown.
Posts [ 6 ]
Pages: 1
Powered by FluxBB
[ Generated in 0.027 seconds, 6 queries executed ]