2017-12-04 23:54
浏览 97


I am trying to make a single page web app that runs over a websocket for all server request. After the user logs in, I want the page to change the html to display a dashboard (first page).

I have a template for the dashboard already build from a previous version. I need to find a way to input database info into template and send the page over the websocket as a string for the javascript to display.

I don't know how to fill the template using php classes without hard coding it into the class, then turning it into a string so I can send it. The dashboard is very complex and has dynamically built menus for each users per their settings and permissions.

Am I looking at this whole problem wrong? I have some experience with MVC from ruby on rails/node.js, but unfortunately this app is stuck using php. Can I use a framework with the socket? Should I have the JS load the template through https and send the data over the socket? (The JS guy would not like that).

I am running Ubuntu, apache2, php7, Ratchet WebSocket(wss), composer, and MySQL all on AWS.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试制作一个单页Web应用程序,它运行在websocket上,用于所有服务器请求。 用户登录后,我希望页面更改html以显示仪表板(第一页)。

我有一个已经从之前版本构建的仪表板模板。 我需要找到一种方法将数据库信息输入到模板中,并通过websocket将页面作为字符串发送给javascript来显示。

我不知道如何使用php类填充模板而不将其硬编码到类中,然后将其转换为字符串以便我可以发送它。 仪表板非常复杂,并且每个用户的设置和权限都有动态构建的菜单。

我是否错误地看待这整个问题? 我对rails / node.js上的ruby有一些MVC的经验,但不幸的是这个应用程序被使用php卡住了。 我可以在套接字上使用框架吗? 我应该让JS通过https加载模板并通过套接字发送数据吗? (JS的人不喜欢这样)。

我在AWS上运行Ubuntu,apache2,php7,Ratchet WebSocket(wss),作曲家和MySQL。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题