问题
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:
- Separate the file into two parts and include both when you need both, and only one when you only need that one part
- 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