Grow your CSS skills. Land your dream job.

Parse error: syntax error, unexpected $end ….. i cant figure where it is ..

  • # January 30, 2012 at 10:40 am

    i am working with theme option page at wordpress .

    this is my code :


    < ?php



    $themename = "3thoob";
    $shortname = "3th1";

    // Create theme options

    $options = array (

    array( "name" =>__('إعدادات تويتر'),
    "desc" => __('فقط أضف اسم الحساب والذي يكون بعد علامة / في الرابط'),
    "id" => $shortname."_twitter",
    "std" => "wordpress",
    "type" => "text"),

    array( "name" => __('إعدادت الإعلان'),
    "desc" => __("أضف رابط صور الإعلان"),
    "id" => $shortname."_Ads",
    "std" => __(""),
    "type" => "text"),

    array( "name" => __('من أنا'),
    "desc" => __("أضف هنا النص الذي تريد ان يظهر في خانة ( من أنا ) في أسفل الصفحة الرئيسية"),
    "id" => $shortname."_whoimi",
    "std" => __("اكتب ما تريد هنا"),
    "type" => "textarea",
    "options" => array( "rows" => "5",
    "cols" => "80") )


    );

    function mytheme_add_admin() {

    global $themename, $shortname, $options;

    if ( $_GET == basename(__FILE__) ) {

    if ( 'save' == $_REQUEST ) {

    foreach ($options as $value) {
    update_option( $value, $_REQUEST[ $value ] ); }

    foreach ($options as $value) {
    if( isset( $_REQUEST[ $value ] ) ) { update_option( $value, $_REQUEST[ $value ] ); } else { delete_option( $value ); } }

    header("Location: themes.php?page=theme-options.php&saved=true");
    die;

    } else if( 'reset' == $_REQUEST ) {

    foreach ($options as $value) {
    delete_option( $value ); }

    header("Location: themes.php?page=theme-options.php&reset=true");
    die;

    } else if ( 'reset_widgets' == $_REQUEST ) {
    $null = null;
    update_option('sidebars_widgets',$null);
    header("Location: themes.php?page=theme-options.php&reset=true");
    die;
    }
    }

    add_theme_page($themename." Options", "3thoob Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');

    }

    function mytheme_admin() {

    global $themename, $shortname, $options;

    if ( $_REQUEST ) echo '

    '.$themename.' '.__('settings saved.','thematic').'

    ';
    if ( $_REQUEST ) echo '

    '.$themename.' '.__('settings reset.','thematic').'

    ';
    if ( $_REQUEST ) echo '

    '.$themename.' '.__('widgets reset.','thematic').'

    ';

    ?>

    < ?php if ( function_exists('screen_icon') ) screen_icon(); ?>

    < ?php echo $themename; ?> Options







    < ?php foreach ($options as $value) {

    switch ( $value ) {
    case 'text':
    ?>




    < ?php
    break;

    case 'select':
    ?>




    < ?php
    break;

    case 'textarea':
    $ta_options = $value;
    ?>




    < ?php
    break;

    case 'nothing':
    $ta_options = $value;
    ?>

    " />
    < ?php echo __($value,'thematic'); ?>




    < ?php echo __($value,'thematic'); ?>

    < ?php echo __($value,'thematic'); ?>

    < ?php
    break;

    case 'radio':
    ?>




    < ?php
    break;

    case 'checkbox':
    ?>




    < ?php
    break;

    default:

    break;
    }
    }
    ?>

    < ?php echo __($value,'thematic'); ?>
    < ?php foreach ($value as $key=>$option) {
    $radio_setting = get_option($value);
    if($radio_setting != ''){
    if ($key == get_option($value) ) {
    $checked = "checked="checked"";
    } else {
    $checked = "";
    }
    }else{
    if($key == $value){
    $checked = "checked="checked"";
    }else{
    $checked = "";
    }
    }?>
    />

    < ?php } ?>
    < ?php echo __($value,'thematic'); ?>
    < ?php
    if(get_option($value)){
    $checked = "checked="checked"";
    }else{
    $checked = "";
    }
    ?>
    />















    3thoob theme.



    < ?php
    }
    add_action('admin_menu' , 'mytheme_add_admin');
    ?>//the last line

    and the error is :



    Parse error: syntax error, unexpected $end

    the error happened at the last line …

    i cant figure what the wrong here …… ??

    # January 30, 2012 at 11:08 am

    This is a guess from someone who knows zip about php but try adding an extra } above the add_action

    so

    < ?php }
    }
    add_action('admin_menu' , 'mytheme_add_admin');
    ?>//the last line

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".