Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function catwalkozet_block_info() {
- // This hook returns an array, each component of which is an array of block
- // information. The array keys are the 'delta' values used in other block
- // hooks.
- // The required block information is a block description, which is shown
- // to the site administrator in the list of possible blocks. You can also
- // provide initial settings for block weight, status, etc.
- // Many options are defined in hook_block_info():
- $blocks['catwalkozet'] = array(
- // info: The name of the block.
- 'info' => t('CatWalk Özet'),
- // Block caching options (per role, per user, etc.)
- 'cache' => DRUPAL_CACHE_PER_ROLE, // default
- );
- // This sample shows how to provide default settings. In this case we'll
- // enable the block in the first sidebar and make it visible only on
- // 'node/*' pages. See the hook_block_info() documentation for these.
- return $blocks;
- }
- function catwalkozet_block_view()
- {
- global $block,$node,$page;
- $block['info'] = 'CatWalk Özet...';
- $block['content'] = _create_catwalkozet();
- return $block;
- }
- function _create_catwalkozet()
- {
- global $language;
- if($language->language == 'tr'){
- $lang_path = '/';
- }else{
- $lang_path = '/en/';
- }
- $themeurl = '/drupal/'.path_to_theme().'/images';
- $sql = "SELECT * FROM `node`
- LEFT JOIN `field_data_field_anasayfa_catwalk` ON `field_data_field_anasayfa_catwalk`.`entity_id` = `node`.`nid`
- WHERE type = 'designers_albums'
- AND `node`.`status` = 1
- AND `node`.`language` = '".$language->language."'
- AND `field_data_field_anasayfa_catwalk`.`field_anasayfa_catwalk_value` = 1
- ORDER BY `node`.`created` ASC";
- $rsCount = db_query("SELECT COUNT(*) AS toplam FROM node WHERE type='designers_albums' AND status=1 AND language='".$language->language."'")->fetchAssoc();
- $rsCount = $rsCount['toplam'];
- $rs = db_query($sql);
- if($rsCount>3)
- {
- $arrows = '<a href="javascript:void(0)" id="catwalkleft" onclick="catwalk(false,'.$rsCount.')"></a>
- <a href="javascript:void(0)" id="catwalkright" onclick="catwalk(true,'.$rsCount.')"></a>';
- }else{$arrows = '';}
- $output = '<div id="catwalk">
- '.$arrows.'
- <table cellpadding="0" cellspacing="0" border="0">
- <tr>';
- foreach($rs as $r)
- {
- $c_detay = node_load($r->nid);
- $big = image_style_url('tmb_230x350', $c_detay->field_photos[$language->language][0]['uri']);
- $output.='
- <td>
- <a class="catwalktitle" href="'.$lang_path.'catwalk/'.$c_detay->nid.'">
- '.$c_detay->title.'<br />
- <span>'.$c_detay->field_season[$language->language][0]['safe_value'].'</span>
- </a>
- <img src="'.$big.'" border="0">
- </td>
- <td><div style="width:10px;"></div></td>';
- }
- $output.='</tr></table></div>';
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement