• I wrote a widget, it looks something like this:

    <?php
    
    class IIPredictionLogWidget extends WP_Widget
    {
      function IIPredictionLogWidget()
      {
        $widget_ops = array('classname' => 'IIPredictionLogWidget', 'description' => 'Un widget che mostra le previsioni aziendali di II' );
        $this->WP_Widget('IIPredictionLogWidget', 'II Prediction Log', $widget_ops);
      }
    
      function form($instance)
      {
        $instance = wp_parse_args( (array) $instance, array(
    	'title' => ''
    		) );
    
    		    $title = $instance['title'];
    
    	?>
    	stuff
    <?php
      }
    
       function update($new_instance, $old_instance)
      {
        $instance = $old_instance;
        $instance['title'] = $new_instance['title'];
    
    	    return $instance;
      }
    
        function widget($args, $instance)
      {
    
          echo $after_widget;
      }
    
      }
    add_action( 'widgets_init', create_function('', 'return register_widget("IIPredictionLogWidget");') );

    It lets creates a widget and it lets a user type in a Stock, and a date. When you hit save it saves those values in the widget.

    I want to create a script from another file altogether that runs once a day, but it needs to use the values that the user adds through the widget in WP-admin.

    How does one go about doing this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter phpchick

    (@phpchick)

    Found it Andrew, but when I go in there, the value looks like this…

    a:2:{i:2;a:41:{s:5:”title”;s:18:”Last 5 Predictions”;s:7:”symbol1″;s:4:”KORS”;s:7:”symbol2″;s:4:”GMCR”;s:7:”symbol3″;s:4:”MSFT”;s:7:”symbol4″;s:1:”M”;s:7:”symbol5″;s:4:”LULU”;s:6:”price1″;s:5:”48.34″;s:6:”price2″;s:5:”17.92″;s:6:”price3″;s:5:”32.87″;s:6:”price4″;s:5:”35.87″;s:6:”price5″;s:5:”58.98″;s:12:”shortsymbol1″;s:3:”TIF”;s:12:”shortsymbol2″;s:3:”KSS”;s:12:”shortsymbol3″;s:3:”BKS”;s:12:”shortsymbol4″;s:4:”LQDT”;s:12:”shortsymbol5″;s:4:”DECK”;s:11:”shortprice1″;s:5:”60.34″;s:11:”shortprice2″;s:5:”60.87″;s:11:”shortprice3″;s:5:”20.28″;s:11:”shortprice4″;s:5:”32.87″;s:11:”shortprice5″;s:5:”60.83″;s:4:”cat1″;s:11:”Sales Accel”;s:4:”cat2″;s:11:”Competition”;s:4:”cat3″;s:7:”Surface”;s:4:”cat4″;s:11:”Holiday Str”;s:4:”cat5″;s:11:”Sales Accel”;s:9:”shortcat1″;s:14:”Sandy Exposure”;s:9:”shortcat2″;s:11:”Macro Conce”;s:9:”shortcat3″;s:10:”Nook Decel”;s:9:”shortcat4″;s:13:”Decel Traffic”;s:9:”shortcat5″;s:8:”Ugg Risk”;s:5:”date1″;s:5:”11/16″;s:5:”date2″;s:5:”11/16″;s:5:”date3″;s:5:”11/17″;s:5:”date4″;s:5:”11/17″;s:5:”date5″;s:5:”11/20″;s:10:”shortdate1″;s:5:”11/15″;s:10:”shortdate2″;s:5:”11/08″;s:10:”shortdate3″;s:5:”11/20″;s:10:”shortdate4″;s:5:”11/17″;s:10:”shortdate5″;s:5:”11/18″;}s:12:”_multiwidget”;i:1;}

    How in bloody hell does one take that and turn it into something nice to work with? There must be some short cut?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using the values of Widget for another file’ is closed to new replies.