加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP语法错误意外’}’

发布时间:2020-12-13 22:32:58 所属栏目:PHP教程 来源:网络整理
导读:这里有新手 PHP.我收到以下错误: Parse error: syntax error,unexpected ‘}’ in … on line 1 下面是代码,我很难找到这个简单的错误.有人可以帮忙吗?这个文件是wordpress论文主题的文件,用PHP. ?php// Using hooks is absolutely the smartest,most bull
这里有新手 PHP.我收到以下错误:

Parse error: syntax error,unexpected ‘}’ in … on line 1

下面是代码,我很难找到这个简单的错误.有人可以帮忙吗?这个文件是wordpress论文主题的文件,用PHP.

<?php

// Using hooks is absolutely the smartest,most bulletproof way to implement things like plugins,// custom design elements,and ads. You can add your hook calls below,and they should take the
// following form:
// add_action('thesis_hook_name','function_name');
// The function you name above will run at the location of the specified hook. The example
// hook below demonstrates how you can insert Thesis' default recent posts widget above
// the content in Sidebar 1:
// add_action('thesis_hook_before_sidebar_1','thesis_widget_recent_posts');

// Delete this line,including the dashes to the left,and add your hooks in its place.

/**
 * function custom_bookmark_links() - outputs an HTML list of bookmarking links
 * NOTE: This only works when called from inside the WordPress loop!
 * SECOND NOTE: This is really just a sample function to show you how to use custom functions!
 *
 * @since 1.0
 * @global object $post
*/

function custom_bookmark_links() {
    global $post;
?>
<ul class="bookmark_links">
    <li><a rel="nofollow" href="http://delicious.com/save?url=<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>" onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>','delicious','toolbar=no,width=550,height=550'); return false;" title="Bookmark this post on del.icio.us">Bookmark this article on Delicious</a></li>
</ul>
<?php
}

/*** HEADER AD WIDGET***/
register_sidebars(1,array(
'name' => 'HeaderAd','before_widget' => '<li id="%1$s">','after_widget' => '</li>','before_title' => '<h3>','after_title' => '</h3>'
)
);
function header_widget() { ?>
<div id="header_widget_1">
<ul class="sidebar_list">
<?php thesis_default_widget(3); ?>
</ul>
</div>
<?php }

add_action('thesis_hook_header','header_widget','1');
/***  HEADER WIDGET END***/

/*remove footer attribution*/
remove_action('thesis_hook_footer','thesis_attribution');

function seth_godin_stuff_1 () {
if (is_single()) {
?>
<p class="alert" style="text-align:center;">Interested in a free 25+ eBook on the 7 Wastes? Please <a href="http://www.shmula.com/7-wastes-of-lean/">DOWNLOAD HERE</a>.</p>
<?php
}
}

add_action('thesis_hook_before_post','seth_godin_stuff_1','1');

function single_post_ads() {
if (is_single()) { ?>
<BR>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td rowspan="2"><script type="text/javascript" src="http://forms.aweber.com/form/06/1421749706.js"></script></td>
<td><a target="new" href="http://amzn.to/ddLMpa"><img class="alignnone size-full wp-image-4151" title="the-toyota-way-ad-unit" src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2010/08/the-toyota-way-ad-unit.jpg" alt="" width="102" height="157" /></a></td>
<td><a target="new" href="http://amzn.to/9epSyC"><img class="alignnone size-full wp-image-4152" title="the-toyota-way-fieldbook-ad-unit" src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2010/08/the-toyota-way-fieldbook-ad-unit.jpg" alt="" width="111" height="158" /></a></td>
<td><a target="new" href="http://amzn.to/ac4i1v"><img class="alignnone size-full wp-image-4149" title="the-toyota-culture-ad-unit" src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2010/08/the-toyota-culture-ad-unit.jpg" alt="" width="98" height="161" /></a></td>
</tr>
<tr><td colspan="5"><div align="center"><h5>This post was written by <a href="http://www.shmula.com/about-peter-abilla/" rel="author">Pete Abilla</a></h5>
</div></td></tr>
</tbody>
</table>
</div>
<?php }
}

add_action('thesis_hook_after_post','single_post_ads');

remove_action('thesis_hook_after_post','thesis_post_tags');


/*social bookmarks right header*/
function thesis_header_ad() {
?>
<div id="banner_ad">
<div align="center">
<a rel="nofollow" href="http://www.linkedin.com/in/shmula">
<img src="http://www.shmula.com/wp-content/uploads/image/social-icons/linkedin.jpg"
height="68" width="68" border="0" alt="" /></a>&nbsp; <a rel="nofollow" href="http://twitter.com/shmula">
<img src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2011/04/Twitter.png" height="70" width="70" border="0"
alt="follow shmula on twitter" /></a>&nbsp; <a rel="nofollow"
href="http://www.facebook.com/shmula">
<img src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2011/04/FaceBook.png"
height="70" width="70" border="0" alt="" /></a>&nbsp;<a href="http://feeds.feedburner.com/shmula/dfYo">
<img src="http://www.shmula.com/http://www.shmula.com/wp-content/uploads/Image/2011/04/Feed.png"
height="70" width="70" border="0" alt="" /></a>&nbsp; <a href="http://forms.aweber.com/form/77/1324894377.htm">
<img src="http://www.shmula.com/wp-content/uploads/image/social-icons/Email.gif"
height="70" width="70" border="0" alt="" /></a>
</div>
</div>
<?php
}//end of php block

/* BEGIN Custom Widgetized Footer */
if (function_exists('register_sidebar')) {      

register_sidebar(array('name' => 'Footer Widget ','id' => 'footer-widget-','before_widget' => '<div class="widget">','after_widget' => '</div>','after_title' => '</h3>'));}

function widgetized_footer() { ?><div id="widgetized_wrapper"> <?php 

  if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widget') ) : ?> 
    <?php endif; ?>
    </div>
  <?php 
}

remove_action('thesis_hook_footer','thesis_attribution');add_action('thesis_hook_footer','widgetized_footer');
/* END Custom Widgetized Footer *//*footer widget*/

/*custom popular posts thumbnails*/
function pop_posts_with_thumbs() { ?>
    <li class="widget popular_posts">
        <h3>POPULAR POSTS</h3>
        <ul>
        <? $args = array('posts_per_page' => 28,'orderby' => 'comment_count','category__in' => array(131,16,29,17,281,651,120,193,650,135,147,9,508,64,613,654,655));
        global $post;
        $popular = get_posts($args);
        foreach($popular as $post) {
            setup_postdata($post); ?>
            <li>
                <a href="<?php the_permalink(); ?>" title="Permalink to <?php the_title(); ?>">
                    <?php if(has_post_thumbnail()) { the_post_thumbnail('thumb'); } ?><?php the_title(); ?>
                </a>
            </li>
            <!--[if lte IE 6]>
                <div class="clear"></div>
            <![endif]-->
        <? } ?>
        </ul>
    </li>
<? }
add_action('thesis_hook_after_sidebar_1','pop_posts_with_thumbs');

/*thumbnail functions*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 610,9999,true );
add_image_size( 'teaser',150,true );
add_image_size( 'thumb',50,true );

/*link rel for next/prev*/
add_action('wp_head','index_rel_link'); // Relational link for site index
add_action('wp_head','start_post_rel_link'); // Relational link for first post
add_action('wp_head','adjacent_posts_rel_link_wp_head'); // Relational links for adjacent posts
add_action('wp_head','parent_post_rel_link'); // Relational link for parent item

解决方法

我添加了缺少的功能.现在这段代码正在运行: http://codepad.org/mSjq2eE3

问题是什么.它在这里不可见.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读