Difference between revisions of "Extension talk:Friends.php"

From Organic Design wiki
m
(output html)
Line 7: Line 7:
 
In this context we obtain the ''title_id'' in this way:
 
In this context we obtain the ''title_id'' in this way:
 
<pre>
 
<pre>
 +
function wgExplandTag( &$parser, &$text ) {
 
$id = $wgTitle->getArticleID();
 
$id = $wgTitle->getArticleID();
  
Line 17: Line 18:
  
 
while ($row = $dbr->fetchRow($res)) $list[] = $row[0];
 
while ($row = $dbr->fetchRow($res)) $list[] = $row[0];
print_r($list);
+
 
 +
$out = "<pre id=itworks>":
 +
$out .= print_r($row, -1);
 +
$out = "</pre>":
 +
 
 +
return $html;
 +
}
 
</pre>
 
</pre>

Revision as of 03:47, 25 March 2008

sql query (to get names of users who have edited a particular page):

select distinct user_name from user,revision where user.user_id = revision.rev_user and revision.rev_page = 5000;

Parser function

In this context we obtain the title_id in this way:

function wgExplandTag( &$parser, &$text ) { 
$id = $wgTitle->getArticleID();

$dbr  = &wfGetDB(DB_SLAVE);
$u = $dbr->tableName('user');
$r = $dbr->tableName('revision');

$sql = "select distinct user_name from $u,$r where $u.user_id = $r.rev_user and $r.rev_page = $id;";
$res  = $dbr->query($sql);

while ($row = $dbr->fetchRow($res)) $list[] = $row[0];

$out = "<pre id=itworks>":
$out .= print_r($row, -1);
$out = "

":

return $html; }