timberline wrote:The issue is I need to automate this with a script so I don't have to use the Panel because we need to install the same thing on many sites. I can inject the necessary code into either page.json for 1.index or config.user.json but then I still have to go into the Panel and Save the appropriate page. I can't inject into the appropriate file in _cache\pages because it wouldn't have been created yet anyway.
You would always need to do
something from the panel. How else would you be able to tell a specific page: "On this page I want to load XML feed and display"? I would have liked to have a more concrete technical description, including links for the XML resources, so I could give a cut-and-paste response. Therefore, my reply will be a bit generic:
1. For each page you want to display this feed, simply add empty element into content:
<div data-obituary></div>
2. In panel settings -> custom -> custom JS, use the x3_page_load() function, and check if the empty element exists:
function x3_load_page(){
if($('div[data-obituary]').length){
// element exists, load some stuff into it
var element = $('div[data-obituary]');
// YOUR CODE HERE
}
}
3. Then you would just load the feed, and inject the loaded content into the element
// YOUR CODE HERE
$.get('http://somedomain/somefolder/feed', function (data) {
// loaded!
});
Basically the #3 above would be similar to what you are already using. So I am not sure how it can get any easier than this ... The site admin simply needs to add <div data-obituary></div> when they want to load the dynamic content. It obviously needs to get activated for a page somehow the panel in any case.
timberline wrote:What do you suggest to make adding this "feed" functionality as quick and easy as possible on lots of sites? Thank you!
Well, you already have the feed no? Just include the custom script into the custom JS settings for your X3 website, and it's ready. To include the feed in a page, user would just need to add the <div data-obituary></div> into the content input for any page.
So the above is to load the feed into X3. I don't have any idea about how feed output is created of course, and it would not have anything to do with X3 so I can't comment on that. Likely you just upload your FEED script into location.