Help with my plugin and variables?
-
I am writing a plugin, and am having some problems. I want users to set their username in the script. The script so far is:
<?php /* Plugin Name: TweetPress Plugin URI: http://www.podtube.co.cc/ex/tweetpress Description: Twitter on the side. Version: 1.2.9.2 Author: Zack Fulpington Author URI: http://www.podtube.co.cc/ */ $twitter_username = "ziggyzack99"; add_action('plugins_loaded', 'tpinit'); function tpinit() { if (!function_exists('register_sidebar_widget')) { return; } register_sidebar_widget('TweetPress', 'tweetpress_function'); register_widget_control('TweetPress', 'tweetpress_menu'); } $broom = isset($_POST['username']); function tweetpress_menu () { ?> <p style="text-align:left"><label for="username">Twitter Username: <input style="width: 200px;" id="username" name="username" type="text" value="<?php echo $username; ?>" /></label></p> <?php } function tweetpress_function($args) { $twitter_username = "ziggyzack99"; echo $args['before_widget']; echo $args['before_title'] . 'Twitter' . $args['after_title']; ?> <div id="twitter_div"><ul id="twitter_update_list"></ul></div> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/<?php echo $twitter_username?>.json?callback=twitterCallback2&count=1"></script> <? echo $args['after_widget']; } ?>Now, at the top, you define $twitter_username. Then, at the bottom, the sidebar widget should output it so it shows your twitter feed with javascript. Everything works fine and dandy, except the echo does not work! Why is this?
The topic ‘Help with my plugin and variables?’ is closed to new replies.