What does this feature do? Ability to tag other projects in tickets, simply by adding something like
traq-3 would automatically parse it to a link to a view of the project traq-3
I have already added this functionality to my installation whereas I only need to type a projects code name (no styling like above) and then it just links me to /views/%themedir%/tickets.php
All I did was add a function to get all the codenames then something like (away from server atm): [code] //formattext() foreach($project_codenames as $codename) { $text = preg_replace("#($codename)#", "<a href='project/url'>$1</a>", $text); } [/code]
as a matter of fact heres the whole thing
[code]formattext() { $codenames = project_codenames($project['id']); foreach($codenames as $codename) { $text = preg_replace("#(\b" . $codename['codename'] . "\b)#i", '<a href="' . $uri->anchor($project['slug'], 'tickets') . '">$1</a>', $text); }
//This is just a clone of project_milestones() function project_codenames($project_id=NULL) { global $project, $db; $project_id = ($project_id == NULL ? $project['id'] : $project_id);
$codenames = array();
$fetch = $db->query("SELECT * FROM `".DBPF."projects` WHERE `id`='".$db->res($project_id)."'");
while($info = $db->fetcharray($fetch))
$codenames[] = $info;
return $codenames;
} }[/code]
O_o soo thats the infamous _interwikilinks callback function huh, never been able to figure out what it was parsing lol. well for those of you who dont know that was [ [ traq-3 ] ] without spaces; so i guess adding the square bracket format is out of the question; but you could always parse the same way I do :D