dougou8573 2010-11-18 18:53
浏览 46
已采纳

PHP到Javascript并回到HTML设计问题

(1) On server side I have a piece of PHP code that takes data from DB and converts them into a sort of Javascript array/matrix, let's just simply call it the PHP_OUTPUT

(2) On client side I have a piece of Javascript code that takes the PHP_OUTPUT and renders it as an HTML table.

Unfortunately Google does not read Javascript, so if I want Google to see the contents of the HTML table, I must write down in page the real HTML of the table. So now I need a NEW piece of PHP code to create by itself the SAME HTML table created by the Javascript code.

One way is obviously to rewrite in PHP all the Javascript code that renders the HTML table. Code rewriting is a sport that I don't like much.

Another way (I don't know if possible) is in some way to:

a) have (1) to pass the PHP_OUTPUT to (2),

b) then (2) creates the HTML table and sends (in some way) back the HTML source of the table to server,

c) finally the NEW piece of PHP code on server just writes down the source with a simple echo.

It's convoluted, but this would reduce the amount of code to be written to almost zero.

But is there a simple way to do this kind of stuff?


Hope you understand what I wrote, plz comments to ask for explanations.

Thanks for any answer.

  • 写回答

2条回答 默认 最新

  • doufangyan6862 2010-11-18 19:03
    关注

    Could you not simply have the PHP also dump the DB data into a hidden div of some sort? If it is simply for indexing purposes, it does not necessarily have to be in a human-readable table format, right?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试