Skip to content

Instantly share code, notes, and snippets.

@anak10thn
Created May 21, 2012 05:35
Show Gist options
  • Save anak10thn/2760665 to your computer and use it in GitHub Desktop.
Save anak10thn/2760665 to your computer and use it in GitHub Desktop.
brows
<div class="row">
<div class="span8 contentbox">
<div class="gallery">
<h2><?php echo $title; ?></h2>
<?php foreach ($adverts as $adv => $list) { ?>
<?php $thumbs = unserialize($list->thumbs); ?>
<a style="background-image: none;" href="<?php echo site_url('advert/item') . '/' . $list->slug; ?>" rel="popover" title="<?php echo $list->title; ?>" data-content="<?php echo $list->desc; ?>">
<img src="<?php echo base_url() . $thumbs['path_thumb_small']; ?>"><hr><span><?php echo substr_replace($list->title, '..', 20, -1); ?></span>
</a>
<?php } ?>
<div class="clear"></div>
</div>
<?php echo $pagination; ?>
</div>
<?php
foreach ($categories as $ctg => $category) {
$arr_kategori[] = $category->slug;
}
$kategori_slug = implode("\",\"",$arr_kategori);
?>
<script type="text/javascript">
function kapital(str){
return (str + '').replace(/^([a-z])|\s+([a-z])/g, function ($1) {
return $1.toUpperCase();})
}
$(document).ready(function(){
var url = "http://iklanologi.com/index.php/browse";
var idkategori = ["all","<?php echo $kategori_slug; ?>"]; //id atrribute kategori
$('#sort_method,#location_side').click( function(){
for(i=0; i<=idkategori.length; i++){
replace = idkategori[i].replace("-"," ");
uword = kapital(replace);
$('#'+idkategori[i]).attr('href',url+"/"+$('#sort_method').val()+"/"+$('#location_side').val()+"/"+idkategori[i]);
}
});
for(i=0; i<=idkategori.length; i++){
replace1 = idkategori[i].replace("-"," ");
uword = kapital(replace1);
$('.categoriesbox').append("<details><summary><a class='category' id='"+idkategori[i]+"' href='"+url+"/"+$('#sort_method').val()+"/"+$('#location_side').val()+"/"+idkategori[i]+"'>"+uword+"</a></summary></details>");
}
});
</script>
<div class="span4 sidebarbox">
<div class="sortbox">
<h4>Urutkan</h4>
<?php
$options_method = array(
'all' => 'Pilih Metode',
'featured' => 'Featured',
'populars' => 'Populars',
'newest' => 'Newest',
'random' => 'Random',
);
/*$attr = 'id="sort_method" data-placeholder="Pilih metode..." class="chzn-select" style="width:240px;" tabindex="2"';
echo form_dropdown('sort_method', $options_method, $method_slug, $attr);*/
?>
<select id="sort_method" style="width:240px;" tabindex="2">
<?php
foreach ($options_method as $method_a => $method_v) {
echo "<option value='".$method_a."'>".$method_v."</option>";
}
?>
</select>
</div><br>
<div class="clear"></div>
<div class="sortbox">
<h4>Lokasi</h4>
<?php
/*$options['all'] = "Semua Lokasi";
foreach ($locations as $lct => $location) {
$options[$location->slug] = $location->location;
}
$attr = 'id="location_side" data-placeholder="Pilih lokasi anda..." class="chzn-select" style="width:240px;" tabindex="2"';
if (!empty($location_slug)) {
echo form_dropdown('location', $options, $location_slug, $attr);
} else {
echo form_dropdown('location', $options, '', $attr);
}*/
?>
<select id="location_side" style="width:240px;" tabindex="2">
<?php
foreach ($locations as $lct => $location) {
echo "<option value='all'>Semua Lokasi</option>";
echo "<option value='".$location->slug."'>".$location->location."</option>";
}
?>
</select>
</div><br>
<div class="categoriesbox">
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment