dongyuan2652 2014-02-19 22:50
浏览 55
已采纳

根据用户名使所有其他看不见的可见tr

i have a table containing messages that are clickable links with the following structure:

<tr><td>#</td><td><a href='messages/". $file .".php'>$file</a></</td></tr>
...

$file always has this kind of structure as document name:

Date of submission [2014-02-19] - Subject [clean the garage] - To(everybody)

the table looks like this:

Date of submission [2014-02-19] - Subject [clean the garage] - To(Everybody)
Date of submission [2014-02-15] - Subject [clean the bathroom] - To(Annita)
Date of submission [2014-02-11] - Subject [clean the livingroom] - To(Rudy)

when a user logs in the $username echo's out for example Annita or Rudy or... Now what i would like to know if it is possible to make only the <tr> 's visible for the logged in user with according to(...) name

for example when Annita is logged in, she only gets to see the <tr>'s that has her name in it, and that for example the $file <tr> with Rudy becomes invisible. When the message is to(Everybody) all users can see the message

I hope my question is clear and somebody can help or explain me... thx in advance. breaking my head over this, and i cant change the structure of the message names...

  • 写回答

1条回答 默认 最新

  • dongziche8030 2014-02-19 23:25
    关注

    Why don't you use PHP to parse the file for $username? If $username exists in the file, then you include it.

    See here: PHP - parsing a txt file

    E.g., I'm logged in as Rudy, so $username = 'Rudy.' Now I use PHP to find all the files that match the regular expression /To\(Rudy\)$/ (which you'll write dynamically based on $username) and include them. Javascript is definitely not the right tool for the job here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

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