RedJumpsuit

jobberBase custom development and support

 

Code School

The elusive http://

some people in the forum recently started asking for a workaround on the website URL redirecting issue when the site provided in the job ad lacks the http:// (the site will think you are redirecting from a page within the site) by default jobberBase should be adding this at the beginning of the URL but sometimes it does and sometimes it doesn’t (still have to sit down and re-check why this is happening.) and just merely appending http:// on the URL in the job-details.tpl file will not always work. here is a script i created that tightly checks the URL provided in the job ad, whether http:// should be added or not (hasn’t failed me yet so far!)

open up page_job.php, after this line

$smarty->assign('job', $info);

add this block:

if (substr($info['url'],0,7) == "http://" AND strpos($info['url'], "."))
{
	$smarty->assign('job_url', $info['url']);
}
elseif (substr($info['url'],0,7) != "http://" AND strpos($info['url'], "."))
{
	$smarty->assign('job_url', 'http://'. $info['url']);
}

then open the file job-details.tpl from your templates folder and use this line to display the job poster’s URL.

{if $job_url != ''}<a href="{$job_url}" target="_blank">{$job.company}</a>{else}{$job.company}{/if}

if you’ve tried this and encountered error, let me know. i would be interested to find out!

Tagged as: , , , , ,

3 Comments

Code School

  1. I tried this fix, and encountered issues.

    I think it is the code being added into the jobs-details.tpl file

    I used a temporary fix that I am not happy with so if you can help me to get your code block to work that would be great.

    here is what I currently got on jobs-details.tpl

    {if $job.url && $job.url != ‘http://’}
    {$job.company}

    when I replace it with your code I get this error and it will not display the job details.
    If I add your code and do not remove the existing code then I get duplication of the users link

  2. I tried your fix and it worked perfectly on the first try.

    I re-added the STRONG tags to the company name in my job-details.tpl file (line 28).


    {if $job_url != ''}{$job.company}{else}{$job.company}{/if}

    THANK YOU!!! That was driving me nuts. WORSE was that on my previous deployment at Portland Auto Jobs it did that error for the first 3 POSTINGS, then stopped all the sudden and never did it again!!!

    But on this new deployment Portland Auto Jobs, it hasn’t stopped doing it yet….

    AT ISSUE of course is the bug where the COMPANY NAME URL is hyperlinked instead to the POST ITSELF and NOT the Company Website (although it tries to append the company website URL at the end of the post URL. This is equivalent to an HTML error where you try to do an A tag without HTTP, like this

    FOO

    Thanks for the fix!

Trackbacks

  1. A Better URL Fix | RedJumpsuit

Leave a Response