Last updated May 27, 2008. Created by ipwa on May 27, 2008.
Log in to edit this page.
<?php
function phptemplate_views_ajax_page_item($node) {
//return '<pre>' . print_r($node, true) . '</pre>';
$file=next($node->files);
$path = $node->nid;
$imgtag='<img src="/'.$file->filepath.'" alt="" />';
return l($imgtag, 'node/'. $node->nid, NULL, NULL, NULL, NULL, TRUE);
}
?>You need to add this function to the template.php in your theme, or if it doesn't have one, create a file called template.php and put this function there. Remember not to include the php tags, which are there only to highlght the syntax.
After you add that theme function you need to create your AJAX View block.
- Create or edit a View
- Specify a Page view of any type
- Specify a Block view with "AJAX Paging Block View" type and the node count you want on each page, I recommend 4
- Specify an argument of type "AJAX Views: AJAX Selector" with "Display all values" specified
- If you have other arguments, make sure there are valid wildcards for them
- Add a Node:Published filter and leave it as default
- Add a Node:Type filter and set it to Is One Of -> video (the cck type where you upload your videos)
- Finally, either embed your view in a page via views_build_view('block', $view) or put your block in a region
By default your block will show the thumbnails in a vertical list, so we need to add some CSS to the theme:
/**********ajax views blocks**********/
.ajax_views_body ul {list-style: none; margin:0; padding: 10px 0;}
.ajax_views_body ul li {width: 150px; display: inline; padding-right: 20px;}Hopefully this worked out for you, post any comments if you are having problems with this.