test
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • brentwilliams2 Friend
    #187548

    For those of you who want to customize the template for an individual job, you will want to be able to pull the individual field values. I don’t know all of them, but I hope this helps. (You might find more information here.)

    For a custom text field, here is the format:

    <?php echo $item->fieldname; ?>

    Just replace “fieldname” with the name of the field. You can find this by going to the “Forms Customization” section in the back end of the component. (Note: This will also work for standard text fields, such as Job Code.)

    You might also only want to show the field if it has a value. To do this, simply add some code:

    <?php if($item->fieldname) echo $item->fieldname; ?>

    With the example above, the field will only show up if there is a value.

    Here are some of the standard fields and how to include them on your job template:

    Location:

    <?php echo getLocation($item->location_id); ?>

    Category:

    <?php echo getCategories($item->cat_id); ?>

    Salary Minimum (with included currency symbol):

    <?php echo $item->currency . number_format($item->salary_min); ?>

    Salary Maximum (with included currency symbol):

    <?php echo $item->currency . number_format($item->salary_min); ?>

    Personally, I wanted to show both of these on the same line, but sometimes an employer will only include the minimum or the maximum. So I made different scenarios to show the salary as “Up to $XXXX” or “Starting at $XXXX”. (This code assumes you use the standard two column table)

    <?php if(($item->salary_min || $item->salary_max) > 0): ?>
    <tr class="<?php echo $classname; ?>">
    <td width="20%" class="jajb-title">
    Salary Range:
    </td>
    <td width="80%">
    <?php
    if($item->salary_min && $item->salary_max){
    echo $item->currency . number_format($item->salary_min) . ' - ' . $item->currency . number_format($item->salary_max);
    } else {
    if ($item->salary_max == 0){
    echo 'Starting at ' . $item->currency . number_format($item->salary_min);
    } else {
    if ($item->salary_min == 0){
    echo 'Up to ' . $item->currency . number_format($item->salary_max);
    }
    }
    }
    ?>
    </td>
    </tr>
    <?php endif; ?>

    Job Type:

    I don’t know this one. If anyone can help, please let me know and I’ll update.

    Job Description:

    This is another that I don’t know. This one is critical, so any help would be appreciated.

    That’s it for now. I hope it helps!

    brentwilliams2 Friend
    #493007

    I don’t see an edit button, so let me add some more fun stuff here.

    How to make your category linked:

    <?php $cat_id_alias = getCategories($item->cat_id);?>
    <a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jajobs&layout=filter_job_list&cat_id_alias='.$cat_id_alias.'&cat_id='.$item->cat_id.'&Itemid='.$this->Itemid)?>" title="<?php echo $cat?>"><?php echo getCategories($item->cat_id); ?></a>

    How to make your location linked:

    <?php $location_id_alias = getLocation($item->location_id); ?>
    <a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jajobs&layout=filter_job_list&location_id_alias='.$location_id_alias.'&location_id='.$item->location_id.'&Itemid='.$this->Itemid)?>" title="Jobs in <?php echo trim($location_id_alias)?>">
    <?php echo $location_id_alias; ?></a>

    How to make a custom field linked. I found this helpful for a city field I added, so I have used that as the example:

    <a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jajobs&layout=filter_job_list&filter_keyword='.$item->city.'&Itemid='.$this->Itemid)?>" title="Jobs in <?php echo $item->city;?>">
    <?php echo $item->city;?>
    </a>

    Note: This last example technically works; however, it doesn’t match the link structure to when you use the filter module. (i.e., if you typed in the city in the filter module, the link would look different.)

    I’ll add more tips if I find them.

    brentwilliams2 Friend
    #493158

    I figured out how to show the description!

    <?php echo htmlspecialchars_decode($item->job_detail); ?>

    brentwilliams2 Friend
    #493877

    I wish I could edit these! I realized that the link for the custom field was not quite right, potentially. This was the original code I shared above:

    <a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jajobs&layout=filter_job_list&filter_keyword='.$item->city.'&Itemid='.$this->Itemid)?>" title="Jobs in <?php echo $item->city;?>">
    <?php echo $item->city;?>
    </a>

    However, I realized that this just created a simple filter for that that particular word. So for example, if a company advertised a job in Miami, Florida, but in the job ad description, they mentioned doing work in New York, then that Miami job would mistakenly show up when the link was for New York. I hope that makes sense. For some fields, you might not care, and actually prefer having the link include the word from anywhere in the job, but it’s obviously not good for city searches.

    So here is the updated code:

    <a href="<?php echo JRoute::_('index.php?option=com_jajobboard&view=jajobs&layout=filter_job_list&city='.$item->city.'&Itemid='.$this->Itemid)?>" title="Jobs in <?php echo $item->city;?>">
    <?php echo $item->city;?>
    </a>

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 1 voice, and was last updated by  brentwilliams2 11 years, 6 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum