php - Installing TabView extention in a MediaWiki site -


i'm trying install tabview extension on mediawiki site. downloaded php file this page , put in extensions folder follow .../extensions/tabview/tabview.php

added following line localsettings.php file:

require_once("$ip/extensions/tabview/tabview.php"); 

somehow, when tried use tag on of page, got error:

fatal error: class 'f' not found in /var/www/html/camnang.vysajp.org/public/extensions/tabview/tabview.php on line 107

is there anyway fix this?

the tabview extension linked seems depend on wikia nirvana framework, , on wikiasuperfactory class (which class "f" dummy subclass of). through framework, instantiates jssnippets object wikia jssnippets extension.

in short, js side of extension seems make use of whole bunch of wikia-specific code. try adding dependencies wiki, might easier replicate functionality using standard mediawiki features.


specifically, looking @ jssnippets class documentation (see links above), addtostack() call tell browser asynchronously load 2 linked js files , then, once files have loaded, call js function tabview.init() named arguments id , selected (passed properties of generic object, in json).

it shouldn't hard same thing standard mediawiki resourceloader. first, need define resourceloader module loads scripts need (warning: untested code!):

$wgresourcemodules['ext.tabview'] = array(     'scripts' => array( 'js/mustache.js', 'js/tabview.js' ),     'localbasepath' => __dir__,     'remoteextpath' => 'tabview', ); 

insert somewhere near top of extension code, outside function definitions. you'll need copy mustache.js library tabview/js subdirectory.

(i believe loading 2 js files should work, resourceloader's scoping peculiarities. of course, if had several extensions used mustache.js library, more efficient , elegant make separate module itself, need glue script did window.mustache = mustache;.)

in hook function, need tell mediawiki load module , call tabview.init() function, this:

$opts = array( 'id' => "flytabs_$id", 'selected' => $optionsindex ); $opts = json_encode( $opts ); $js = "mw.loader.using( 'ext.tabview', function () { tabview.init($opts) } );"; $out .= "<script type='text/javascript'>$js</script>"; 

ps. tabview.js file says "[d]epends on skins/oasis/js/tab.js". couldn't find file name in wikia's repo, there is skins/oasis/js/tabs.js may need copy tabview/js subdirectory , add module definition alongside mustache.js.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -