I have something like this on every page:
<div data-b="[0-9]+" ...>...</div>
In jQuery, I'm finding the last instance using:
var lB = $('[data-b]').last().data('b');
(Shout out to Fotiman for helping me with that one)
But can you guys suggest a way to get the same value using PHP? I would need to run it on the footer page that's included on every page of the site, finding the last "data-b" value on the page that included it, up to that point. So it needs to be fast, and put minimal stress on the server and minimal impact on load time.
I know that I could use cURL to read the entire page into a string, but that seems like overkill and slow if it's on every page.
As an alternative, I could go through every page and manually create a variable at the end for the value.
But I'm hoping that you guys can suggest an easier option that wouldn't be as slow as cURL and that I wouldn't have to modify every page.