duanlao1552 2014-03-13 09:35
浏览 19

Zend Framework 2为每个用户定制样式

I am building an application for companies which sends anonymous-links to customers for filling out a questionnaire. The company should be able to change the colors and the logo of the questionnaire to reflect the affiliation to the company's CI.

My idea was to make a folder for every company (in my case, represented as doctrine entity Client) and load the layout's style.css and logo.png etc. dynamically from this folder.

The question: how do I implement this? How can I change a variable in the layout file from the controller? Or do I have to place the whole layout inside the view.phtml file for the ViewModel?

Thanks in advance!

  • 写回答

2条回答 默认 最新

  • drza10046 2014-03-13 11:39
    关注

    You need to set style.css and logo file path according to company name in you action and then you can access this vairable in you layout also as same as you access in view file. And set you css with headLink() function. and assign logo file in layout header.

    You don't need to place layout code in view file. Write below code on you controller. you can also access style variable in you layout.

    return new ViewModel(array( 'style' => $style ,'logo' => $logo));
    
    评论

报告相同问题?

悬赏问题

  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启