In all my posts above, I have recommended using a separate PHP file to generate the XML data (so that the code can be accessed and reused from different pages) using the following process:
Your 'original' PHP file would create your main web page including your gallery's embedding code. Within the embedding code you would point towards a different PHP file (using the configUrl configuration option) which would generate the XML data. Once processed by the server, the data output by this PHP file would look just like an XML file to a browser.
The PHP file which would generate the XML data would look something like the file in this forum post.
However, as you suggested, an alternative would be to use a session variable using the following process:
Have the XML data generated in your 'original' PHP file and save the data as a long string in a session variable.
Point towards a different PHP file (using the configUrl configuration option).
In this PHP file, you would simply output the contents of the session variable. The entire PHP file would look something like this:
<?php
header('Content-type: application/xml');
session_start();
echo $_SESSION['xmldata'];
?>Both methods will work fine but you do need to have your XML data in a separate file (whether it is generated by the file itself or simply passed to the file in a session variable).
It would not be possible to generate the XML code in your 'original' PHP file (which generates the page containing the gallery's embedding code) and pass it directly to the gallery.