duanpei8518 2012-10-18 20:52
浏览 41

在页面上包含wordpress页眉/页脚时,不会显示编辑数据库

I am using a wordpress site, but for a part of the site, I have decided that I will manually connect to the database and basically bypass wordpress for editing the database and retrieving results.

the problem is, when I include the WP header and footer, I am getting a blank page, viewing source gives an error although I have being unable to understand it.

This is the source code displayed for the page:

<!DOCTYPE html> <!--[if IE 6]> <html id="ie6" <br /> <font size='1'><table class='xdebug-error xe-fatal-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'> <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Call to undefined function language_attributes() in C:\wamp\www\thurston\wp-content\themes\twentyeleven\header.php on line <i>15</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0013</td><td bgcolor='#eeeeec' align='right'>388104</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\wamp\www\thurston\wp-content\themes\twentyeleven\editdb.php' bgcolor='#eeeeec'>..\editdb.php<b>:</b>0</td></tr> <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0024</td><td bgcolor='#eeeeec' align='right'>438352</td><td bgcolor='#eeeeec'>require( <font color='#00bb00'>'C:\wamp\www\thurston\wp-content\themes\twentyeleven\header.php'</font> )</td><td title='C:\wamp\www\thurston\wp-content\themes\twentyeleven\editdb.php' bgcolor='#eeeeec'>..\editdb.php<b>:</b>3</td></tr> </table></font>

Sorry for the jumble but that's all that is displayed.

The code for the actual page is this (linked to it as the code function on this site would not work):

https://dl.dropbox.com/u/10062971/editdb.php

And the wordpress header:

https://dl.dropbox.com/u/10062971/header.php

Adding to the database and then displaying the information from the database works on the main page, it's just clicking edit and going to the editdb.php page where the problems are.

Does anyone have any ideas?

  • 写回答

1条回答 默认 最新

  • duanbishai5271 2012-10-18 21:06
    关注

    language_attributes() is located in wp-includes/general-template.php.

    You can't just include header.php and foter.php and hope for the best. you must include all dependencies.

    Insert an anchortext in a page like [myAnchorText] use output buffering to catch the final HTML and replace the achor text:

    <?php
    // example from php.net
    function callback($buffer) {
      // replace all the apples with oranges
      //or whatever logic you have
      return (str_replace("[myAnchorText]", "oranges", $buffer));
    }
    ob_start("callback");
    ?>
    <html><body>
    <p>It's like comparing apples to oranges.</p>
    </body></html>
    <?php ob_end_flush(); ?>
    /* output:
       <html><body>
       <p>It's like comparing oranges to oranges.</p>
       </body></html>
    */
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。