SSI - Only include part of file?

北慕城南 提交于 2019-12-11 07:27:19

问题


I have a file which contains a lot of news & updates that I display on my website using SSI. What I would like to do is to have a subset of these news and updates that appear in a column elsewhere in the website.

I have tried looking around online, however I'm not sure if this is even possible. I get the impression that I'd need to create a new file that contains the subset. I just feel this solution isn't particularly elegant since I'm duplicating data.

Does anyone have any ideas?


回答1:


Since you can't include part of a file you have a couple of options:

  1. Separate the file into two parts and include both when you need both, and only one when you only need that one part
  2. Separate the file into two parts and create a third SSI which includes both. Then on the pages where you need both you can include just the one file that includes both for you.



回答2:


you could also pass a parameter to the file and evaluate this parameter in the included file (assuming this is treated as a SSI page as well)



来源:https://stackoverflow.com/questions/10753582/ssi-only-include-part-of-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!