The_man

Topic: How to place companies cloud in sidebar

Anybody knows how to bring the "companies cloud" to the sideabar? the one that shows in the companies sections.

Thank you in advance, I´ll appreciate the help.

Last edited by The_man (2008-08-30 21:14:29)

The_man

Re: How to place companies cloud in sidebar

like the one in www.hireme.sg

matteoraggi

Re: How to place companies cloud in sidebar

all we have this code on COMPANY FOLDER: http://www.lavorohotel.net/companies/
you just need to copy this code and put it into sidebar.tpl or something similar..

The_man

Re: How to place companies cloud in sidebar

Yeah, I tried that thinking it was that simple copy /paste code from one place to the other, but for some reason it only shows the cloud in the sidebar as I want it, but in the "companies" page only not in the home page or other pages. I must be missing something...

Anybody can help?

matteoraggi

Re: How to place companies cloud in sidebar

could you show the code that you copied to understand exactly your situation?

flakdesign

Re: How to place companies cloud in sidebar

Hi,

In page_home.php, Add

Code:

$companies = array();
    $sanitizer = new Sanitizer();
    $sql = 'SELECT DISTINCT company FROM jobs WHERE is_temp = 0 AND is_active = 1 ORDER BY Rand() ASC LIMIT 20';
    $comps = $db->QueryArray($sql);
    foreach ($comps as $company)
    {
        $sql = 'SELECT COUNT(id) AS nr
                       FROM jobs
                       WHERE company = "' . $company['company'] . '"';
        $nr = $db->QueryItem($sql);
        if ($nr < 2)
        {
            $tag_height = 1;
        }
        else if ($nr >= 2 && $nr < 3)
        {
            $tag_height = 2;
        }
        else if ($nr >= 3 && $nr < 4)
        {
            $tag_height = 3;
        }
        else if ($nr >= 4 && $nr < 5)
        {
            $tag_height = 4;
        }
        else if ($nr >= 5 && $nr < 6)
        {
            $tag_height = 5;
        }
        else if ($nr >= 6)
        {
            $tag_height = 6;
        }
       
        $companies[] = array('name' => $company['company'],
                             'varname' => $sanitizer->sanitize_title_with_dashes($company['company']),
                             'count' => $nr,
                             'tag_height' => $tag_height);
    }
    $smarty->assign('companies', $companies);
    $smarty->assign('companies_count', count($comps));

And in the tpl file add

Code:

<div class="companycloud">
        <h3>Company Cloud</h3>
        <p class="names">{section name=tmp loop=$companies}
            <span class="company-tag-{$companies[tmp].tag_height}">
                <a href="{$BASE_URL}jobs-at/{$companies[tmp].varname}/">{$companies[tmp].name}</a>
            </span>
            {/section}
            <br />
            </p>
            <p class="clearfix viewmore"><a href="{$BASE_URL}companies/">View All &rarr;</a></p>   
    </div>

regards
vinay

matteoraggi

Re: How to place companies cloud in sidebar

good, I hope it will be in new version too wink

The_man

Re: How to place companies cloud in sidebar

Hey Flakdesign. Thanks man! I really appreciate your help.