I am having trouble getting the Flickr widget to work, I have the Flickr module up and working, but the Flickr widget isn't showing in the blog module widgets section. Does anyone have this working? anyone have any advice?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hiya,
Do you have other widgets working?
Have you selected the widget to appear in the Blog?
Are you calling $WidgetArea or whatever you have associated?
Josh
I have the youtube widget working, and the other standard ones that come with the blog. The Flickr one just isn't showing up in the admin screen under blog>widget at all.
Anyone have this working? Or can anyone pinpoint why this isnt working for me?
Anyone got any ideas?
This just doesn't seem to be working for me. Not showing up in the widget tab at all
I have now tried a new install of the Blog module, the Flickr module, and a fresh install of Silverstripe, and still the Flickr widget isnt showing up in the Blog window.
I have also tried making it a seperate widget in the root install, tried adding it into the Blog, and still it isn't working. Does anyone have it working?
So I finally think I have found the answer to getting the Flickr Widget working, and I will post it here just in case anyone else has the same problem.
I was looking over the Widget Documentation at: http://doc.silverstripe.org/doku.php?id=widgets
Which uses the Flickr Widget as an example, by pasting in this code instead of the one that comes with the Module, I managed to get it working. However, I did have to put back in some of the code from the module, as it was referencing the wrong files for the lightwindow.
See the code below for the working Flickr Widget.
FlickrWidget.php
<?php
class FlickrWidget extends Widget {
static $db = array(
"User" => "Varchar",
"Photoset" => "Varchar",
"Tags" => "Varchar",
"NumberToShow" => "Int"
);
static $defaults = array(
"NumberToShow" => 8
);
static $title = "Photos";
static $cmsTitle = "Flickr Photos";
static $description = "Shows flickr photos.";
function Photos() {
Requirements::javascript("flickrservice/javascript/prototype.js");
Requirements::javascript("flickrservice/javascript/effects.js");
Requirements::javascript("flickrservice/javascript/lightwindow.js");
Requirements::css("flickrservice/css/FlickrGallery.css");
Requirements::css("flickrservice/css/lightwindow.css");
if( $pos = strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) {
$version = substr( $_SERVER['HTTP_USER_AGENT'], $pos + 5, 3 );
if( $version < 7 ) {
Requirements::css("flickrservice/css/lightwindowIE6.css");
}
}
$flickr = new FlickrService();
if($this->Photoset == "") {
$photos = $flickr->getPhotos($this->Tags, $this->User, $this->NumberToShow, 1);
} else {
$photos = $flickr->getPhotoSet($this->Photoset, $this->User, $this->NumberToShow, 1);
}
$output = new DataObjectSet();
foreach($photos->PhotoItems as $photo) {
$output->push(new ArrayData(array(
"Title" => $photo->title,
"Link" => "http://farm1.static.flickr.com/" . $photo->image_path .".jpg",
"Image" => "http://farm1.static.flickr.com/" .$photo->image_path. "_s.jpg"
)));
}
return $output;
}
function getCMSFields() {
return new FieldSet(
new TextField("User", "User"),
new TextField("PhotoSet", "Photo Set"),
new TextField("Tags", "Tags"),
new NumericField("NumberToShow", "Number to Show")
);
}
}
?>