Hi Mandy,
thank you for your answer.
After reading my text again i can see how it can be confusing.
Lets say that i have a plugin folder named “fbplugin”
– Inside the fbplugin folder, there is a “inst.php” and “index.php”
“inst.php” is the plugin installation file for admin with the following code:
<?php
require_once ($_SERVER["DOCUMENT_ROOT"] . '/wp-content/plugins/fbplugin/filename.php');
/*
Plugin Name: Name
Plugin URI: https://www.company.com
Description: Description
Author: Author
Author URI: https://www.company.com
*/
// create custom plugin settings menu
add_action('admin_menu', 'baw_create_menu');
function baw_create_menu() {
//create new top-level menu
add_menu_page('Menu Title', 'Test', 'administrator', __FILE__, 'baw_settings_page',plugins_url('/images/fileimage.png', __FILE__));
//call register settings function
add_action( 'admin_init', 'register_mysettings' );
}
function register_mysettings() {
//register our settings
register_setting( 'baw-settings-group', '01selection' );
register_setting( 'baw-settings-group', '02selection' );
register_setting( 'baw-settings-group', '03selection' );
register_setting( 'baw-settings-group', '04selection' );
register_setting( 'baw-settings-group', '05selection' );
register_setting( 'baw-settings-group', '06selection' );
}
function baw_settings_page() {
if ($_GET['updated']==true) { ?>
<div id="message" class="updated">
<p>
Updated.
</p>
</div>
<?php
// *** Add your API Key, Secret Key here ***
$appapikey = '[HERE I WANT DATA FROM 01SELECTION]';
$appsecret = '[HERE I WANT DATA FROM 02SELECTION]';
$facebook = new Facebook($appapikey, $appsecret);
// $user_id = $facebook->require_login();
?>
<?php } ?>
<div class="wrap">
<h2>Integrate with your facebook page</h2>
<form method="post" action="options.php">
<?php settings_fields( 'baw-settings-group' ); ?>
<table class="form-table">
<tr valign="top">
<th scope="row">01 selection</th>
<td><input type="text" name="01selection" size="40" value="<?php echo get_option('01selection'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">02 selection</th>
<td><input type="text" name="02selection" size="40" value="<?php echo get_option('02selection'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">03 selection</th>
<td><input type="text" name="03selection" size="55" value="<?php echo get_option('03selection'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">04 selection</th>
<td><input type="text" name="04selection" size="8" value="<?php echo get_option('04selection'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">05 selection</th>
<td><input type="text" name="05selection" size="8" value="<?php echo get_option('05selection'); ?>" /></td>
</tr>
<tr valign="top">
<th scope="row">06 selection</th>
<td><input type="text" name="06selection" size="55" value="<?php echo get_option('06selection'); ?>" /></td>
</tr>
</table>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
</p>
</form>
</div>
<div id="iframeLinkDiv"><a clicktohide="iframeLinkDiv" onClick="outside_location.setInnerFBML(link_1);" style="cursor: pointer;"><img src="<?php echo get_option('03selection'); ?>" border="0" alt="" /></a></div>
<div id="outside_location"></div>
<fb:js-string var="link_1">
<iframe src="<?php echo get_option('04selection'); ?>" height="<?php echo get_option('05selection'); ?>px" allowTransparency="true" frameborder="0" scrolling="<?php echo get_option('06selection'); ?>" style="width:520px; >
</iframe>
</fb:js-string>
<script type="text/javascript" charset="utf-8">
var outside_location = document.getElementById("outside_location");
</script>
</iframe>
<?php } ?>
My question for the first (inst.php) file: how do i get the data from the db for “01selection” and “02 selection” ? They are inside [ ] tags.
– Now for the second file “index.php” in plugins folder
File contains the code:
<?php
require_once ($_SERVER["DOCUMENT_ROOT"] . '/wp-content/plugins/fbplugin/filename.php');
// *** Add your API Key, Secret Key here ***
$appapikey = '[<?php echo get_option('01selection'); ?>]';
$appsecret = '[<?php echo get_option('02selection'); ?>]';
$facebook = new Facebook($appapikey, $appsecret);
// $user_id = $facebook->require_login();
//
echo '<div id="iframeLinkDiv"><a clicktohide="iframeLinkDiv" onClick="outside_location.setInnerFBML(link_1);" style="cursor: pointer;"><img src="<?php echo get_option('03selection'); ?>" border="0" alt="" /></a></div>';
echo '<div id="outside_location"></div>';
echo '<fb:js-string var="link_1">';
echo '<iframe height="<?php echo get_option('04selection'); ?>px" allowTransparency="true" frameborder="0" scrolling="<?php echo get_option('05selection'); ?>" style="width:520px; border:none" src="<?php echo get_option('06selection'); ?>">';
echo '</iframe>';
echo '</fb:js-string>';
echo '<script type="text/javascript" charset="utf-8">
var outside_location = document.getElementById("outside_location");
</script>';
?>
What i would like to do is to get the data from the db and insert it to selections 01 to 06 so that when i type a direct link to /wp-content/plugins/fbplugin/ i can see the index page with results of changes made previously for images and links..
Really hope you can help ??