Php 解析错误:语法错误,意外'<';在C:\Inetpub\wwwroot中\
这是我从零开始的第一个主要WordPress站点。我的PHP技能才刚刚起步,这就是我遇到的错误。我知道问题是什么,我只是不知道如何正确地编写这段PHP代码,希望能得到一些帮助 据我所知,我不能像这里那样将html标记放入PHP代码块中,这很奇怪,因为我看到的所有示例WP循环中都有html标记Php 解析错误:语法错误,意外'<';在C:\Inetpub\wwwroot中\,php,html,wordpress,Php,Html,Wordpress,这是我从零开始的第一个主要WordPress站点。我的PHP技能才刚刚起步,这就是我遇到的错误。我知道问题是什么,我只是不知道如何正确地编写这段PHP代码,希望能得到一些帮助 据我所知,我不能像这里那样将html标记放入PHP代码块中,这很奇怪,因为我看到的所有示例WP循环中都有html标记 <?php /** * Template Name: Home Page *
<?php
/**
* Template Name: Home Page
*
* This Full Width template removes the primary and secondary asides so that content
* can be displayed the entire width of the #content area.
*
*/
// calling the header.php
get_header();
// action hook for placing content above #container
thematic_abovecontainer();
?>
<div id="container">
<?php thematic_abovecontent(); ?>
<div id="content" class="home-content">
<?php
// calling the widget area 'page-top'
get_sidebar('page-top');
the_post();
thematic_abovepost();
?>
<div id="post-<?php the_ID();
echo '" ';
if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
post_class();
echo '>';
} else {
echo 'class="';
thematic_post_class();
echo '">';
}
// creating the post header
// thematic_postheader();
?>
<div class="entry-content">
<?php
the_content();
wp_link_pages("\t\t\t\t\t<div class='page-link'>".__('Pages: ', 'thematic'), "</div>\n", 'number');
edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>
</div>
</div><!-- .post -->
<div class="featureBlocks">
<div class="news">
<div class="featTitle">
<h3>News <br />& Events</h3>
<div class="featSubTitle">What's happening in the world of Process Engineering</div>
<div class="clear"></div>
</div>
<?php
query_posts('cat=4&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();
the_title();
the_content();
/*<a href='<?php the_permalink(); ?>' rel='bookmark' title='Permanent Link to <?php the_title_attribute(); ?>'><?php the_title(); ?></a>*/
endwhile; endif;
// Reset Query
wp_reset_query();
?>
</div>
<div class="research">
<div class="featTitle">
<h3>Research <br />Highlights</h3>
<div class="featSubTitle">Find out what exciting research is happening Process Engineering</div>
<div class="clear"></div>
</div>
<?php
query_posts('cat=5&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();
<strong>the_title();</strong>
the_content();
endwhile; endif;
// Reset Query
wp_reset_query();
?>
</div>
<div class="studentStories">
<div class="featTitle">
<h3>Student <br />Stories</h3>
<div class="featSubTitle">Student life at the Department of Process Engineering</div>
<div class="clear"></div>
</div>
<?php
query_posts('cat=6&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();
the_title();
the_content();
endwhile; endif;
// Reset Query
wp_reset_query();
?>
</div>
<div class="clear"></div>
</div>
<?php
thematic_belowpost();
// calling the comments template
thematic_comments_template();
// calling the widget area 'page-bottom'
get_sidebar('page-bottom');
?>
</div><!-- #content -->
<?php thematic_belowcontent(); ?>
</div><!-- #container -->
<?php
// action hook for placing content below #container
thematic_belowcontainer();
// calling footer.php
get_footer();
?>
研究重点
了解流程工程正在进行哪些令人兴奋的研究
学生故事
过程工程系的学生生活
如果有人能告诉我我正在做什么,我将不胜感激。
非常感谢 在
块中有一个不带引号的字符串。这些块中的任何内容都被解释为PHP语法,而不是原始HTML
这一行:
<h1>the_title();</h1>
需要做到这一点:
echo '<strong>' . the_title() . '</strong>';
回显“”。标题()强>';
请考虑阅读基本的PHP语法,例如;这是一个很小的问题,很多教程都有介绍。在
块中有一个不带引号的字符串。这些块中的任何内容都被解释为PHP语法,而不是原始HTML
这一行:
<h1>the_title();</h1>
需要做到这一点:
echo '<strong>' . the_title() . '</strong>';
回显“”。标题()强>';
请考虑阅读基本的PHP语法,例如;这是一个很小的问题,很多教程都有介绍。作为一个新手,我想用这样的方法:
<div class="news">
<div class="featTitle">
<h3>News <br />& Events</h3>
<div class="featSubTitle">What's happening in the world of Process Engineering</div>
<div class="clear"></div>
</div>
<?php
query_posts('cat=4&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();
?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<a href='<?php the_permalink(); ?>' rel='bookmark' title='Permanent Link to <?php the_title_attribute(); ?>' ><?php the_title(); ?></a>
<?php
endwhile; endif;
// Reset Query
wp_reset_query();
?>
</div>
新闻
&事件
过程工程领域正在发生什么
仅将php代码包装在
标记中。作为一名新手,我希望使用以下内容:
<div class="news">
<div class="featTitle">
<h3>News <br />& Events</h3>
<div class="featSubTitle">What's happening in the world of Process Engineering</div>
<div class="clear"></div>
</div>
<?php
query_posts('cat=4&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();
?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<a href='<?php the_permalink(); ?>' rel='bookmark' title='Permanent Link to <?php the_title_attribute(); ?>' ><?php the_title(); ?></a>
<?php
endwhile; endif;
// Reset Query
wp_reset_query();
?>
</div>
新闻
&事件
过程工程领域正在发生什么
只在
标签中包装php代码。其他人设法在另一个论坛上回答了我的问题。卡什,我希望这对你也有用
<?php query_posts('cat=5&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();?>
<strong><?php the_title();?></strong>
<?php the_content();
endwhile; endif;
?>
谢谢所有参与的人!:) 其他人在另一个论坛上回答了我的问题。卡什,我希望这对你也有用
<?php query_posts('cat=5&posts_per_page=1');
if (have_posts()) : while (have_posts()) : the_post();?>
<strong><?php the_title();?></strong>
<?php the_content();
endwhile; endif;
?>
谢谢所有参与的人!:) 错误消息还应显示行号。它是哪一个?它在代码中的什么位置?(编辑:没关系-SO的语法高亮显示已经显示出来了,从下到上看第6行)嗨,佩卡。这与使用_title()有关。感谢错误消息还应显示行号。它是哪一个?它在代码中的什么位置?(编辑:没关系-SO的语法高亮显示已经显示出来了,从下到上看第6行)嗨,佩卡。这与使用_title()有关。谢谢,可能是因为它在另一个PHP代码块中吗?(我没有在这里发布)。问题是,我正在处理示例循环,除非我忽略了一些东西,否则除了周围的PHP代码之外,没有什么不同。此外,我正在使用Dreamweaver,因此语法颜色处于启用状态:)请查看我的编辑。你是说在另一个
块中有一个
块吗?嗨,JamWaffles。我离开这个项目有一段时间了,但又遇到了同样的问题。我已经重新发布了我的PHP代码片段。这一次是因为它在文件中。问题在于标题()在片段的一半左右。我想我可能不理解PHP块中html标记的用法,但我正在尝试遵循实际WP站点中的其他示例,他们正在使用etcI,我已经编辑了我的答案。看看底部的新内容。可能是因为它在另一个PHP代码块中吗?(我没有在这里发布)。问题是,我正在处理示例循环,除非我忽略了一些东西,否则除了周围的PHP代码之外,没有什么不同。此外,我正在使用Dreamweaver,因此语法颜色处于启用状态:)请查看我的编辑。你是说在另一个
块中有一个
块吗?嗨,JamWaffles。我离开这个项目有一段时间了,但又遇到了同样的问题。我已经重新发布了我的PHP代码片段。这一次是因为它在文件中。这个