Thanks, Mike.
Here's the variation I talked about. Many people will have a CMS where they can't just break the page up into individual chunks in different HTML pages. Instead, they'll be able to put some comments into their CMS template, and then the following alternative pullCMSHeadContent() function will extract the part they marked:
Code:
public function pullCMSHeadContent()
{
$source = file_get_contents("http://www.example.com/blankpage.html");
$startMarker = "<!-- HEAD START -->";
$endMarker = "<!-- HEAD END -->";
$startPos = strpos($source, $startMarker);
$endPos = strpos($source, $endMarker);
if ($startPos === false || $endPos === false)
return '';
$startMarkerLen = strlen($startMarker);
$output = substr($source, $startPos + $startMarkerLen, ($endPos - $startPos) - $startMarkerLen);
return $output;
}
Then using CNN.com as an example, here's how you would modify your basic CMS template (the same template used for all pages in your CMS):
So you just put HTML comments into your main CMS template, and these parts get reused in X-Cart. If you make a blank page, and then insert this for your <head> content (exclude the <title> tag, it's better that X-Cart generates it, you mark another range for after <body> until the content, and the final range for after-content-until-</body>, then X-Cart gets wrapped into your site.
A little caveat, this adds CPU overhead. Especially because you're pulling the same page 3 times. Even if it's coming from a static cache, it's three times processing. It would be better to store it and use it three times. Or to only extract your segments one time and store them until the source has changed.
Anyway, these examples are very basic, I just feel that that's what we need in order to get a handle on the massive X-Cart structure. And they're just to show the principle as I imagine it. This isn't, and shouldn't be rocket science. I've just been stumped with the X-Cart documentation, which reads like a phone book, and there are bugs in the examples, so I've actually spent two days getting to this Hello World example.
But I have it running beautifully here. The rest of the stuff we do runs directly on the database, so I won't likely need to write any more modules. That's why I was trying to avoid getting a whole education in X-Cart development just to do this one thing
Best,
Per
Per