You won't need to change anything. With FURLs on the id tag still returns the id number of the resource.
The solution you're using appears to work fine for you, but it might be difficult to scale to a large number of pages and/or background images.
However, resources can also be CSS files, not just HTML. To scale this approach, you could put the background image for each resource in a TV and then dynamically generate your CSS file using a GetResources call. I set this up the other day for dynamically generating a bunch of CSS sprites, it works well.
That would scale up somewhat, but with a very large number of pages the CSS file would get huge. To circumvent that, you could write a snippet that accepts the page ID as a GET parameter and auto-generates CSS that's specific to that one page. I'd probably write a snippet just to acquire the GET parameter and set it in a placeholder, then use getResourceField to pull in the appropriate TV, that way at least some of the data would be cached to maximize performance. This approach adds an extra HTTP request to each page, however, and an uncached one at that, which might slow your load time significantly.
So in the end, maybe the best and most scalable approach really is to just use inline CSS, unless you have strong objections to that for some reason.
The inline CSS solution has a lot of advantages:
- It's very simple and easy to implement.
- It scales automatically to any number of resources without adding significant overhead.
- It is completely cacheable, and doesn't make any snippet calls so it will perform very fast even uncached.
Speed optimization tools will always tell you to put your CSS in external files for better performance, and that is usually true, but in this case I think it will actually perform quite a bit better inline, at least at a large scale.
[ed. note: esnyder last edited this post 15 years, 1 month ago.]