Author Topic: Display Company name in Spotlight Job  (Read 2268 times)

Offline Semilunars

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
    • View Profile
Display Company name in Spotlight Job
« on: August 15, 2012, 01:28:29 PM »
Hi,
How do you make the company name appears together with other details in spotlight job.

Thx

Offline lalajee

  • Administrator
  • Newbie
  • *****
  • Posts: 17
  • Karma: +1/-0
    • View Profile
Re: Display Company name in Spotlight Job
« Reply #1 on: August 16, 2012, 01:41:46 AM »
Can you give example.

Offline Semilunars

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
    • View Profile
Re: Display Company name in Spotlight Job
« Reply #2 on: August 16, 2012, 03:55:45 AM »
 For example, spotlight job will only display as the following

Job position
Job description
Location
Posted on

I'd like to add "posted by: company_name" at the fifth line.

thanks


Offline lalajee

  • Administrator
  • Newbie
  • *****
  • Posts: 17
  • Karma: +1/-0
    • View Profile
Re: Display Company name in Spotlight Job
« Reply #3 on: August 17, 2012, 03:05:05 PM »
In layout folder open spotlight_jobs_inc.php

After
foreach ( $spotlight_jobs as $job ):

Add following code

$company_name = Employer::get_company_name_by_id( $job->fk_employer_id );
$spotlight[$k]['company_name'] = $company_name;


Now go into Template folder.

Open spotlight_jobs_inc.tpl

Add this line of code into your loop
 
<br /><strong>Posted By:</strong>: {$i.company_name}



Offline Semilunars

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
    • View Profile
Re: Display Company name in Spotlight Job
« Reply #4 on: August 17, 2012, 06:44:49 PM »
Hi,

Thanks for the solution but its not working, after i added the above codes to the two files i get the following error

Fatal error: Call to undefined method Employer::get_company_name_by_id()

Thanks,

Offline lalajee

  • Administrator
  • Newbie
  • *****
  • Posts: 17
  • Karma: +1/-0
    • View Profile
Re: Display Company name in Spotlight Job
« Reply #5 on: August 19, 2012, 06:59:53 PM »
Open class.employer.php from libs folder

and past this code any where after

function __construct()
{

}


public static function get_company_name_by_id( $id=0 ){
      global $db, $database;
      $sql = " SELECT company_name FROM ". self::$table_name;
      $sql .= " WHERE id=".$id;
      $sql .= " LIMIT 1";
      
      $result = $db->query( $sql );
      $num_rows = $db->num_rows( $result );
      $rows = $db->fetch_object($result);
      
      return $rows->company_name;
   }

Offline Semilunars

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
    • View Profile
Re: Display Company name in Spotlight Job
« Reply #6 on: August 20, 2012, 07:51:22 AM »
it works now, big thanks  :D

OPJobBoard

Re: Display Company name in Spotlight Job
« Reply #6 on: August 20, 2012, 07:51:22 AM »