Tuesday, October 26, 2010

Views Change edit link, delete icon into edit and delete icon

Edit Link
Create tpl file with the name "views-view-field--edit-node.tpl.php" inside ur theme directory and write the following code into it.
-----
$output = preg_replace(
'#(]*>)[^<]*()#',
"$1". theme_image(path_to_theme(). '/images1/pics/edit.png') ."$2",
$output
);
print $output;
-----


?>
Delete Link -Same as above Filename: "views-view-field--delete-node.tpl.php" inside ur theme directory
$output = preg_replace(
'#(]*>)[^<]*()#',
"$1". theme_image(path_to_theme(). '/images1/pics/delete.png') ."$2",
$output
);
print $output;


Add Views into Block through custom code

$display_id = 'default';
$arg =arg(2);

$view= views_get_view('VIEWNAME');
$view->execute();
$block_content = $view->execute_display($display_id, $arg);
$block['content'] = $block_content;
return $block;