slideshow: how to change fileset

Permalink 1 user found helpful
Hi ppl,

I am trying to change defined slideshow's fileset through custom template controler.php file.

Fe. here I want to point to fileset ID = 2.

I have tryed changing line 80-82:
$sql = "SELECT fsf.fID, fv.fvFilename, fv.fvPrefix, fav.value FROM FileSetFiles fsf, FileVersions fv, FileAttributeValues fav " .
"WHERE fsf.fsID = ? AND fsf.fID = fv.fID AND fvIsApproved = 1 AND fav.fID = fv.fID AND fav.fvID = fv.fvID AND fav.fakID = ?";
//$files = $this->db->getAll($sql, array($this->fsID, $fak->getAttributeKeyID())); 
$files = $this->db->getAll($sql, array(2, $fak->getAttributeKeyID()));


But no luck. I also thought I might change where clause but also no luck. I am missing something important here.

If anyone could assist me it would be great.

 
ideasponge replied on at Permalink Reply
ideasponge
First read this post to see how to properly add Block via PHP in a Theme file.

This thread may help you.
http://www.concrete5.org/community/forums/customizing_c5/slideshow-...
eOne replied on at Permalink Reply
I am not adding this block via PHP. It is normal block, but I need to have some additional control over it.

I would like to be able to control some aspect of it through page properties; in this example to be able to change fileset that has been shown.
ideasponge replied on at Permalink Best Answer Reply
ideasponge
Ok I found a fix for it.


Basically it is just this added to the top of the custom template.

$controller->type = 'FILESET';
$controller->fsID = 1;
$controller->duration = 2;
$controller->fadeDuration = 1;
$controller->loadFileSet();
$images = $controller->images;


Make sure you add it is a Custom template. if you just hack up the view.php file then that is bad form and leads to bad habits which will open up a whole mess of problems for you later on. This also allows you to use the block normally on other parts of the site.

With this code you can easily reference a Page Attribute as with something like this

if ($c -> getAttribute ('slideshow_set_id')) {
$controller->fsID = $c -> getAttribute ('slideshow_set_id');
}else{
$controller->fsID = 1;
}


I didn't test this with a page attribute so let me know if it works. You will of course to have added the Page Attribute in the Dashboard > Pages and Themes > Attributes section.
eOne replied on at Permalink Reply
Thank you ideaSponge, that worked.

For use of page attributes I had to add global $c before getAttribute.
...
For those, like me, unaware of proper use of custom templates check this:
http://www.concrete5.org/index.php?cID=2921...

Basically; for this to work, view.php file should also implement render of template:

<? 
$bvt = new BlockViewTemplate($b); 
$bvt->setBlockCustomTemplate(false);
include($bvt->getTemplate());
?>