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条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度