Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

Delicious widget problems [Solved]


Reply


1289 Views

Avatar
newtux

Community Member, 1 Post

10 December 2007 at 1:13pm

Edited: 10/12/2007 1:56pm

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

<?php

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 %>