By Dupal Idiot on
Dear Tech friends,
I've installed image slider module. I would like to make the image slider content display as a custom view.
Slider shows only one item at a time and rotating the items. I'm trying to get the block content individually to hide the title, poster, date etc and only image need to show with link to node.
It seems I've to write an override for
node_view(node_load($node->nid), 1)
Complete functions for slider is as follows:
function outbody_of_block($content_type,$delta)
{
$output_body = '';
$sql = " SELECT n.nid, teaser FROM {node} n INNER JOIN {node_revisions} r ON n.nid=r.nid "." WHERE n.status=1 AND n.type='".$content_type."' ORDER BY n.changed DESC LIMIT 5";
$results = db_query($sql);
$output_body .= '<div id="slider'.$delta.'" class="sliderwrapper">'."\n";
while ($data = db_fetch_object($results)) {
$slider_nid = $data->nid;
$output_body .= '<div class="contentdiv">'."\n";
$output_body .= "<a href='".$base_url."/node/".$slider_nid."'>". node_view(node_load($data->nid), 1) ."</a>";
if ($slider_nid == 1) {
$output_body .= '<p></p><a href="javascript:featuredcontentslider.jumpTo(\'slider1\', 3)">';
}
$output_body .= '</div>';
}
$output_body .= '</div>';
$output_body .= '<div id="paginate-slider'.$delta.'" class="pagination">'."\n";
$output_body .= '</div>';
$output_body .= '<script type="text/javascript">';
$output_body .= 'featuredcontentslider.init({'."\n";
$output_body .= 'id: "slider'.$delta.'",//id of main slider DIV'."\n";
$output_body .= 'contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"]'."\n";
$output_body .= 'toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc]'."\n";
$output_body .= 'nextprev: ["Previous", "Next"], //labels for "prev" and "next" links. Set to "" to hide.'."\n";
$output_body .= 'revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover"'."\n";
$output_body .= 'enablefade: [true, 0.2], //[true/false, fadedegree]'."\n";
$output_body .= 'autorotate: [true, 3000], //[true/false, pausetime]'."\n";
$output_body .= 'onChange: function(previndex, curindex){ //event handler fired whenever script changes slide'."\n";
$output_body .= '//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)'."\n";
$output_body .= '//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)'."\n";
$output_body .= '}';
$output_body .= '})';
$output_body .= '</script>';
return $output_body;
//$output_body .= '</div>';
}
function content_slider_page_list($i) {
$content_slider_item = variable_get("content_slider_item", 10);
$dse_news_total = db_query(" SELECT count(*) AS total FROM {node} n WHERE n.type='slider".$i."' AND n.status=1");
$row_news = db_fetch_object($dse_news_total);
$news_total = $row_news->total;
$sql_counts = "SELECT $news_total";
$sql = " SELECT n.nid, n.title, r.teaser FROM {node} n INNER JOIN {node_revisions} r ON r.nid = n.nid WHERE n.type = 'slider$i' AND n.status=1 ORDER BY n.created DESC";
$sql = db_rewrite_sql($sql);
$results = pager_query($sql, $content_slider_item, 0, $sql_counts);
$output = "<div id='content_slider$i'>";
while ($node = db_fetch_object($results)) {
$output .= node_view(node_load($node->nid), 1);
$output .= $content;
}
$output .= theme('pager', NULL, $content_slider_item, 0);
$output .= '</div>';
return $output;
}
Any suggestion anticipated.
Regards,
Richard
Comments
views rotator
Hi Richard,
I'm by no means an expert but if I understand you correctly, at the most basic level, you are simply trying to rotate images linked to a node, on your home page and you would like to be able to define what other fields are included/omitted?
If so, why not try the views rotator module (http://drupal.org/project/views_rotator). I think it will provide the functionality you are looking for. It links in with views 2 and allows for easy customization without having to code anything and is easily themed. I haven't used the module yet myself but there is a great tutorial on it here (http://mustardseedmedia.com/podcast/episode12).
I hope that helps. Let me know if I was way off base.
Pete
Toronto Website Developer
It works...
Thank you pete, it works...