hello
i wanted to read the folder list of theme in a plugin
but i cant write how the directory syntax will be,
my code here:
<?php
/**
* @package Sevendays
*/
/*
Plugin Name: Sevendays
Plugin URI: http://www.mostofa.freeoda.com/Sevendays/
Description: a plugin for switch theme for 7 days
Version: 1.0
Author: Mostofa
Author URI: http://www.mostofa.freeoda.com
*/
add_action('admin_menu','seven_days');
function seven_days()
{
//add_options_page('Seven Days Option','Seven Days','manage_options','seven-days-theme','seven_days_option');
add_options_page('Seven Days Option','Seven Days','manage_options','seven-days','seven_days_option');
}
function seven_days_option()
{
?>
<div id="theme-options-wrap">
<div class="icon32" id="icon-tools">
</div> <h2>Seven Days Option</h2>
<form method="post" action="settingpage.php">
<p class="submit">
<input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
</p>
</form>
</div>
<?php
//here is the directory listing code
$dir=get_theme_root();
//$dir="./";
echo $dir;
$dh=opendir($dir);
$files=array(5);
$i=0;
while(false !== ($filename = readdir($dh)))
{
if(is_dir($filename))
{
if($filename =='.' or $filename=='..') continue;
//$files= $filename;
$files[$i]=$filename;
}
$i++;
}
print_r($files);
closedir($dh);
}
?>
[Please post code or markup between backticks or use the code button. Or better still - use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum's parser.]
it show only path ,because i echo them
but not the directory list