[support] How to restrict the block in all page/URL
bharani kumar
bharanikumariyerphp at gmail.com
Tue Jun 24 18:18:48 UTC 2008
Hi dear
I want to restrict the block display in all pages,
I want to display my block in home page only,
this is my home page URL
http://localhost/test ======> i want to display my block when this url is
in the address bar,
in other place , i dont want to display...
this is my code , tell which place i wants to made the changes
<?php
function cEvents_block($op = 'list', $delta = 0){
switch ($op){
//this is array for display the caption for the block
case 'list':
$blocks[1]['info'] = t('cEvents');
return $blocks;
case 'configure':
if ($delta == 0) {
$form['approval_block_num_posts'] = array(
'#type' => 'textfield',
'#title' => t('Number of pending comments to
display'),
'#default_value' =>
variable_get('approval_block_num_posts', 5),
);
}
return $form;
case 'view':
if(arg(0)!='node' ||arg(0)!='user'||arg(1)!='user/*'){
// $modpath = drupal_get_path('module', 'cEvents');
//drupal_add_css($modpath .'/cEvents.css', 'module');
$num_rows=db_num_rows(db_query("select nid from node where
type='events'"));
if($num_rows>0){
if ($delta == 1 ) {
//drupal_add_css(drupal_get_path('module', 'cEvents')
.'/cEvents.css');
$sql ="select
cn.nid,cn.field_contact_person_value,cn.field_sponsor_value,cn.field_location_value,nr.title,nr.body,nr.teaser
from content_type_events as cn,node as n ,node_revisions as nr where
nr.nid=cn.nid and n.type like 'events' and n.nid=nr.nid";
//$cEvents_block[] = "<div class='column2-unit' >";
$result = db_query_range(db_rewrite_sql($sql), 0, 5);
while ($node = db_fetch_object($result)) {
$cEvents_block[] .=l($node->title,"node/".$node->nid)."
<br>Sponser ".$node->field_sponsor_value."<br>contact person
".$node->field_contact_person_value."<br>Location
".$node->field_location_value;
}
// $cEvents_block[].="</div>";
$block['subject'] = t('Events');
$block['content'] = theme('item_list_ameex',
$cEvents_block);
}
return $block;
}
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080624/8c75f3bd/attachment.htm
More information about the support
mailing list