Forum:Embed Page

Is it possible to embed a page from another wiki? I've tried, but I end up embedding the entire page.


 * Interwiki transclusion only works if you're transcluding something from Community, because it's a big server drag. You can mimic interwiki transclusion with JS, but it uses Ajax which takes time to load. It is worth noting that interwiki transclusion with Ajax is not as much of a server drag, as you already know where the page you're looking for is. It's basically equivalent to loading two pages in rapid succession, which isn't that bad on the server.
 * Hmmm... Okay then. I'll look for alternatives to my problem. Of course, if anyone else has any ideas, do post them here.
 * You could copy the content from one wiki to another (using copy and paste or special:import/special:export) - as long as you attribute that it was originally from one wiki. This has the disadvantage of not updating when one wiki's page updates, though.  Random Time  15:39, April 10, 2011 (UTC)
 * Ajax is the best solution - while it does take extra time to load, it's only a few extra seconds if you've got fast internet, and can be set up so that if it takes forever, users can simply go to the other wiki and view the page there.

Ajax it is then. Code?


 * You'll need JS and a template. The basic template structure should look like the following, and you can put anything in it as a "while you wait" message:

  Loading... http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif
 * This is the JS you'll need:

 function AjaxTransclusion { var div = document.getElementById('AjaxTransclusion'); if(div != null) { var params = div.className; //Parse class name and figure out where the page is we're trying to get var db = params.split(' ')[0]; if(db = 'notransclude') {document.getElementById('AjaxTransclusion').innerHTML = 'Transclusion failed. Check template parameters.'; return false;} var page = ''; for(i = 1; i < params.split(' ').length; i++) { page += params.split(' ')[i] + '_'; }		page = page.substring(0, page.length - 1); $('#AjaxTransclusion').load('http://' + db + '.wikia.com/wiki/' + page + ' #WikiaArticle > *', function (data) {}); } }

addOnloadHook(AjaxTransclusion);
 * The first parameter of the template is the DB name of the wiki you're transcluding the page from (eg, Community Central's DB is, because its url is  ), and the second parameter is the name of the page you're transcluding. When the Ajax finishes loading the page, the "while you wait" message will disappear. This will probably require more tuning - so once you have it set up, could you link to the wiki you put it on so I can make sure it works right?
 * You know what, I think I'll just manually maintain the two pages. The JS looks like more trouble than it's worth, and I've spotted a couple of issues regarding the color scheme of the source page/target wiki. Sorry for wasting your time.
 * If you say so - it's really fairly simple, as long as I put all the -1's in the right place. The worst it'll do is try to load a page with the last character missing.
 * Scratch that, after testing in console it should work just fine.