I have created a career module and jobs can access from below url.
mysite.com/careers
This page shows list of jobs with each job shows "View More" button.
When I click on the "View More" button then open a new page and must be show that selected job full details. So this single page link like to be:-
mysite.com/careers/jobdetails/index/view/1
Here "1" means job ID.
app/code/community/Sumith/Careers/Block/Jobdetails.php
<?php
class Sumith_Careers_Block_Jobdetails extends Mage_Core_Block_Template
{
public function __construct()
{
parent::__construct();
$datasets=Mage::getModel('careers/jobdetails')->getCollection()->addAttributeToSort('sh_job_details_id', 'DESC');//->addAttributeToSelect('*');
$this->setDatasets($datasets);
}
protected function _prepareLayout()
{
parent::_prepareLayout();
$pager = $this->getLayout()->createBlock('page/html_pager')->setCollection($this->getDatasets());
$this->setChild('pager', $pager);
$this->getDatasets()->load();
return $this;
}
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}
} // end of the class
app/code/community/Sumith/Careers/controllers/JobdetailsController.php
<?php
class Sumith_Careers_JobdetailsController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock("head")->setTitle($this->__("Job Details"));
$breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
$breadcrumbs->addCrumb("home", array(
"label" => $this->__("Home Page"),
"title" => $this->__("Home Page"),
"link" => Mage::getBaseUrl()
));
$breadcrumbs->addCrumb("careers", array(
"label" => $this->__("Job Details"),
"title" => $this->__("Job Details")
));
$this->renderLayout();
}
} // end controller class
I'm using magento 1.9 version.
If anyone can help me to fix this appreciate that.