Jump to content

Extension talk:DataTransclusion

About this board

Klenby (talkcontribs)

Need examples wiki with this extension, config example $wgDataTransclusionSources, WebDataTransclusionSource examples. Anybody help me?

Jaideraf (talkcontribs)

I also need these examples. Anybody help us?

LionAlex (talkcontribs)

I'm sure someone has figure this out since this thread is really old but since no one has posted, I figured I'd share what I was able to get to work. This one queries the mediawiki user table for the email address of the user. Not a practical application but just to illustrate how the LocalSettings.php variable is configured:

//DataTransclusion Extension
require_once( "$IP/extensions/DataTransclusion/DataTransclusion.php" );
$wgDataTransclusionSources = array(
       "user"=>array("class"=>"DBDataTransclusionSource",
               "keyFields"=>array("user_name","user_real_name"),
               "keyTypes"=>array("user_name"=>"string","user_real_name"=>"string"),
               "fieldNames"=>array("user_id","user_name","user_email","user_real_name"),
               "query"=>"select user_id, user_name, user_email, user_real_name from user")
       );

On your template called Template:SampleUser

== User: {{{user_name}}} ==
 e-mail:{{{user_email}}}

On your page:

{{#record:SampleUser|user|user_name=TheUserNameGoesHere}}

If someone has a better example, please share!

Reply to "Need examples"
There are no older topics