Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Delicious widget problems [Solved]

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1243 Views
  • newtux
    Community Member
    1 Post

    Delicious widget problems [Solved] Link to this post

    Actually solved my issue. Was using variables in function instead of $this->User.
    Hello, I'm trying to write a del.icio.us linkroll widget and am having some problems. The problem I'm having is that it seems the variables from the php file are not making it to the ss file. It isnt a javascript issues, since the code works when I put it in the ss file without all the variables. There is also a test link to google in the ss file that does display but the script does not. Any help would be appreciated.
    My code is bellow:

    The .php file


    class DeliciousWidget extends Widget {
       static $db = array(
          "User" => "Varchar",
          "Name" => "Varchar",
          "NumberToShow" => "Int"

       static $defaults = array(
          "NumberToShow" => 8

       static $title = "Delicious";
       static $cmsTitle = "Delicious Linkroll";
       static $description = "Shows delicious links.";
       function Links() {
       $LinkVar = "http://del.icio.us/feeds/js/".$User."?count=".$NumberToShow.";title=".$Name .";icon;name;showadd";
       $LinkVar2 = "http://del.icio.us/".$User;

       // $delicious = new DeliciousService();
       $output = new DataObjectSet();
        $output->push(new ArrayData(array(
           "Title" => $Name,
       "Link" => $LinkVar,
       "Link2" => $LinkVar2

       return $output;

       function getCMSFields() {
          return new FieldSet(
             new TextField("User", "User"),
             new TextField("Name", "Linkroll Name"),
             new NumericField("NumberToShow", "Number to Show")


    And the .ss file

    <% control Links %>
       <a href="google.com">Google</a>
       <script type="text/javascript" src="$Link"></script>
       <a href="$Link2">$Title</a>
    <% end_control %>

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.