jobberBase custom development and support


Code School

List Jobs of the Same Company on the Ad


on /_templates/ folder, create a new file and name it “company-posts-loop.tpl”, copy the code below and save it:

<!-- Jobs from the same company -->
{if count($compjobs) > 1}
<strong>{$} {$}</strong><br /><br />
<table id="job-posts" class="job-posts" cellspacing="0">
{foreach item=compjob from=$compjobs}
{if $ != $ }
	{if $compjob.type_id == $smarty.const.JOBTYPE_FULLTIME}
	<img src="{$BASE_URL}img/icon-fulltime.png" alt="full-time" />
	{elseif $compjob.type_id == $smarty.const.JOBTYPE_PARTTIME}
	<img src="{$BASE_URL}img/icon-parttime.png" alt="part-time" />
	{elseif $compjob.type_id == $smarty.const.JOBTYPE_FREELANCE}
	<img src="{$BASE_URL}img/icon-freelance.png" alt="freelance" />
	<a href="{$BASE_URL}job/{$}/{$compjob.url_title}/" title="{$compjob.title}">{$compjob.title}</a> <span class="la">{$}</span> {$}{if $compjob.location == 'Anywhere'}, {$compjob.location}{else} <span class="la">{$}</span> {$compjob.location}{/if}
	<td class="time-posted"><img src="{$BASE_URL}img/clock.gif" alt="" /> {$compjob.created_on}</td>
</table><br />
<a href="{$BASE_URL}jobs-at/{$jobsat}/">{$}</a><strong> {$}</strong>
<br /><br />
<!-- Jobs from the same company -->
<script type="text/javascript">
	$(".job-posts tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
	$(".job-posts tr:odd").addClass("alt");

on /_includes/translations.ini, under [jobs] add the following:

recent_jobs = "Recent jobs at"
all_jobs = "View all jobs at"

on /page_job.php, add the following code.

on the top, right after the php tags:

$sanitizer = new Sanitizer();

and before the line “$smarty->assign(‘job’, $info);”, add the following:

// ######### list other jobs by the same company #########
$compjobs = $job->ApiGetJobsByCompany($info['company'], 5, false);
$sanitizedcomp = $sanitizer->sanitize_title_with_dashes($info['company']);
$smarty->assign('compjobs', $compjobs);
$smarty->assign('jobsat', $sanitizedcomp);
// ######### list other jobs by the same company #########

this will display the 5 most recent jobs by the same company. the 2nd param [limit] of the function “ApiGetJobsByCompany([company], [limit], [for feed])” will determine the maximum jobs that will be displayed from the same company. Also, this will not list the current job that is currently being displayed.

and lastly, open up /_templates/job-details.tpl and add the new template under the job description portion.

<div id="job-description">
{include file="company-posts-loop.tpl"}


Code School

  1. This is my error report. Do you’ve got any tips?
    Warning: Error parsing /home/w9306326/domains/ on line 32 in /home/w9306326/domains/ on line 20

    Warning: Invalid argument supplied for foreach() in /home/w9306326/domains/ on line 156

  2. never mind it was probably a problem in the translation.ini file

  3. hi, never encountered this issue. do you have your error reporting on? it should give you an error if something isn’t working on the script. not sure what info i can give you if i don’t know what’s wrong.

  4. I had some problems with this. The jobs never displayed. Does the company have to have 5 jobs before they are displayed? I’m not receiving any errors, just nothing displaying.

    Any ideas?

  5. I’m having the same problem; don’t get any error but the jobs don’t display. Any suggestion? If its any help, i’m happy to provide you access to my system.

  6. You need to replace {include file=”company-posts-loop.tpl”} with {include file=”company-post-loop.tpl”}

  7. It does not work for me too. Please look into this bug. I am using latest version of Jobberbase.

  8. should be resolved by the above comment and the tutorial was also updated. what specific error are u encountering?

  9. BTW above file listed in the comment does not exist: company-post-loop.tpl since the file which was asked to create in tutorial was company-posts-loop.tpl ?

  10. read the instruction again. if you follow the tutorial you shouldn’t have any probs!

  11. I tried it again…posted 2 jobs…it didn’t show and while posting the third job now it shows this error:

    Notice: Undefined variable: job_id in /var/www/jobberbase/page_write.php on line 155

    Fatal error: Uncaught exception ‘QueryException’ with message ‘You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 12’ in /var/www/jobberbase/_includes/class.Db.php:36 Stack trace: #0 /var/www/jobberbase/_includes/class.Job.php(865): Db->query(‘UPDATE jobs SET…’) #1 /var/www/jobberbase/page_write.php(177): Job->Edit(Array) #2 /var/www/jobberbase/index.php(100): require_once(‘/var/www/jobber…’) #3 {main} thrown in /var/www/jobberbase/_includes/class.Db.php on line 36

    So I cannot go beyond the second job.

  12. I did everything exactly the way it was described in the tut, but it doesn’t work for me. I can’t see any changes on the website. Plz help!

  13. This Hack is now a part of upcoming Jobberbase 1.8 version.

  14. Hello,

    How can I limit the number of “recent jobs at a company” to 5 because my website display all the jobs.


  15. Version 1.9.1 doesn’t seem to limit the number of recent jobs. Thus, when viewing a particular job, all the other jobs of the same company are displayed.

    Any suggestions?

Leave a Response