2011-05-24 24 views
3

不太確定'php'與它有什麼關係。請查看http://iamwhitebox.com/staging/arkitek/#pressPHP不在.INC文件中執行

我的頁面上有一個默認選項卡,顯示按日期排序的2篇博文。 但它不會顯示,當我在菜單中單擊它時,我已將它包括在兩個不同的地方 ,有沒有一種更簡單的方法來實現此目的?我知道有

<?php 
    // Include WordPress 
    define('WP_USE_THEMES', false); 
    require('/home/whiteb0x/iamwhitebox.com/staging/arkitek/blog/wp-blog-header.php'); 
    query_posts('cat=3&showposts=2'); 
?> 

     <article class="blog-feed"> 
<?php while (have_posts()): the_post(); ?> 
<!-- begin post --> 
      <div class="blog-title"> 
       <div class="blog-date"> 
       <?php the_time('m.j.Y'); ?> 
       </div> 
      <strong><a class="blog-link" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>"> 
<?php the_title(); ?> 
       </a></strong> 
      </div> 
<a class="blog-link" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>"> 
<div class="blog-thumbnail"><?php the_post_thumbnail(array(80,80)); ?></div><?php the_content(); ?> 
</a> 
<div class="clearfix"></div> 
<?php endwhile; ?> 
     </article> 

<?php 
     // Include WordPress 
     define('WP_USE_THEMES', false); 
     require('/home/whiteb0x/iamwhitebox.com/staging/arkitek/blog/wp-blog-header.php'); 
     query_posts('cat=3&showposts=2'); 
    ?> 
    <!DOCTYPE html> 
    <html> 
    <head></head> 
    <body> 

     <ul> 
      <li id="current_news"> 
    <?php 
    echo "HELLO"; 
    ?> 
    **<?php 
     require('post.inc') 
    ?>** 
+5

將您的文件名更改爲'post.inc.php' – diEcho 2011-05-24 05:19:51

+0

ok一秒我嘗試過之前,然後我得到了奇怪的行爲,如菜單中的每個鏈接加載相同的#anchor在我的文檔 – iamwhitebox 2011-05-24 05:27:45

回答

3

是否post.inc開始用<?php

如果你希望你的代碼在你包含的時候執行,那麼你的包含文件就有這樣的重要性。