开发者

.inc File Not Included Reliably

I am working on some HTML code that was inherited from another programmer, which uses include statements of the form:

~inc:filename.inc~

However, the problem I am encountering is that this include statement does not work reliably. About 90% of the time, all information in the included file is imported with no problem, but every so often all of that content goes missing when I refresh the page and comes back in when I refresh again. I have already tried changing the include statements to more widely-used forms such as:

<!-- FILE="filename.inc"-->
<!-- virtual="../filename.inc"-->
<!-- virtual="/filename.inc"-->

but this only results in the file consistently not being included at all. I have been poking around other places on the Internet, b开发者_开发问答ut can't seem to find any solutions or even any usage of of the '~inc:' include statement.

It is worth noting that this HTML is being loaded from firmware hosted on low-power equipment and certain items on the page are updating regularly. Is it possible that the updating methods are simply running too fast for the hardware to handle?

Does anyone have any ideas for how I can solve this problem?


OK, so I downloaded the application library documentation and looked in TCPIP Stack Help.chm and found the HTTPIncFile function:

void HTTPIncFile(ROM BYTE* cFile);

Users should not call this function directly, but should instead add dynamic variables in the form of ~inc:filename.ext~ in their HTML code to include (for example) the file "filename.ext" at that specified location. The MPFS2 Generator utility will handle the rest.

So it looks like your original syntax is the only documented one. Now, although it says not to call the function directly, since you're having problems, it might be worth doing that to see if you get the same results.

Also note that:

When curHTTP.callbackPos is 0, the file is opened and as many bytes as possible are written. The current position is then saved to curHTTP.callbackPos and the file is closed. On subsequent calls, reading begins at the saved location and continues. Once the end of the input file is reached, curHTTP.callbackPos is set back to 0 to indicate completion.

This is pure speculation, but it's possible that you might encounter issues if you try to include the file more than once, or try to include one or more files at the same time. If a file is not being included, it could be because the callbackPos wasn't reset. I was also assuming you aren't trying to modify the template file, but you did say:

certain items on the page are updating regularly

If the files you wish to include are changing, you are probably encountering concurrency problems. You may need to resort to locking or synchronization to make sure this doesn't happen, or try wait-spinning on the include method, checking the offset, until you successfully include a positive number of bytes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜