<!-- apps/frontend/modules/job/templates/indexSuccess.php --> <?php use_stylesheet('jobs.css'); ?> <div id="jobs"> <?php foreach ($categories as $category) { ?> <div class="category_<?php echo Jobeet::slugfy($category->getName()); ?> "> <div class="category"> <div class="feed"> <a href="">Feed</a> </div> <h1><?php echo link_to($category, 'category', $category); ?> </h1> </div> <?php include_partial('job/listJobs', array('jobs' => $category->getActiveJobs(sfConfig::get('app_max_jobs_on_homepage')))); ?> <?php if (($count = $category->countActiveJobs() - sfConfig::get('app_max_jobs_on_homepage')) > 0) { ?> <div class="more_jobs">
public function getLocationSlug() { return Jobeet::slugfy($this->getLocation()); }
public function getSlug() { return Jobeet::slugfy($this->getName()); }
<?php // test/unit/JobeetTest.php require_once dirname(__FILE__) . '/../bootstrap/unit.php'; $t = new lime_test(9, new lime_output_color()); $t->comment('::slugfy()'); $t->is(Jobeet::slugfy('Sensio'), 'sensio', '::slugfy() converts all characters to lower case'); $t->is(Jobeet::slugfy('sensio labs'), 'sensio-labs', '::slugfy() replaces a white space by a -'); $t->is(Jobeet::slugfy('sensio labs'), 'sensio-labs', '::slugfy() replaces several white spaces by a single -'); $t->is(Jobeet::slugfy(' sensio'), 'sensio', '::slugfy() removes - at the beginning of a string'); $t->is(Jobeet::slugfy('sensio '), 'sensio', '::slugfy() removes - at the end of a string'); $t->is(Jobeet::slugfy('paris,france'), 'paris-france', '::slugfy() replaces non-ASCII characters by a -'); $t->is(Jobeet::slugfy(''), 'n-a', '::slugify() converts the empty string to n-a'); $t->is(Jobeet::slugfy(' - '), 'n-a', '::slugify() converts a string that only contains non-ASCII characters to n-a'); if (function_exists('iconv')) { $t->is(Jobeet::slugfy('Développeur Web'), 'developpeur-web', '::slugify() removes accents'); } else { $t->skip('::slugify() removes accents - iconv not installed'); }