1) Does this theory sound correct?
So it seems.
2) Assuming I need to use functions in my site's
framework, what's the
best way to make this work?
I suppose you could do some strange trickeries to avoid
the function, like
<?Php
do_data()
render_page();
if ($show_wiki) require("index.php");
?>
However, i think you're using the wrong approach here.
You could allow the users to go to /wiki/ with the wiki having an Skin
to resemble your site's skin (you can even callback to your site's
code).
http://www.mediawiki.org/wiki/Manual:Skinning
Also, if you only want to convert wikitext to html, you can use the
Parser class in your code.