I have made some changes in phpBB code
adding a link to an article tag
Link to an article.
[lart={artikle number} lang={langage code}]
for example
[lart=8 lang=en]
and two faq image tags
[fimg]{image url}[/fimg]
[fimg desc={Image Descriptio}]{image url}[/fimg]
with mouse over and tooltip support.
This is more than a quick hack to store all FAQ images in one folder I am thinking of adding a seperate DB table with image locations and descriptions.
However I havent managed to export the FAQ to pdf
containing images in either png,gif,jpg.
Adobe acrobat issues a warning message when reading the resulting pdf file. - "Insufficient Image Data".
These are the changed/new functions.
Code: Select all
/*
* Funktion fόr Umwandlung der BB-Codes | @@ Thorsten, 2001-07-01
* Contributor: Meikel Katzengreis, 2003-02-21
* Last Update: @@ Thorsten, 2003-07-23
*/
function parseUBB($ret) {
// /////////////////////////////////////////////////////// //
// SITE FAQ IMAGE LOCATION
//
// /////////////////////////////////////////////////////// //
$faqimagesfold="http://www.example.com/images/faq/";
// /////////////////////////////////////////////////////// //
$ret = stripslashes($ret);
$ret = htmlspecialchars($ret, ENT_QUOTES);
$pattern = array( '{\[b\](.*)\[/b\]}smUi',
'{\[u\](.*)\[/u\]}smUi',
'{\[i\](.*)\[/i\]}smUi',
'{\[ul\](.*)\[/ul\]}smUi',
'{\[li\](.*)\[/li\]}smUi',
'{\[url=(.*)\](.*)\[/url\]}smUi',
'{\[url\](.*)\[/url\]}smUi',
'{\[img\](.*)\[/img\]}smUi',
'{\[size=(.*)\](.*)\[/size\]}smUi',
'{\[color=(.*)\](.*)\[/color\]}smUi',
'{\[align=(.*)\](.*)\[/align\]}smUi',
'{\[\\\\\]}smUi',
'{\[center\](.*)\[/center\]}smUi',
'{\[fimg\](.*)\[/fimg\]}smUi', //MY MOD
'{\[fimg desc=(.*)\](.*)\[/fimg\]}smUi', //MY MOD
);
$replace = array( '<b>\\1</b>',
'<u>\\1</u>',
'<i>\\1</i>',
'<ul>\\1</ul>',
'<li>\\1</li>',
'<a href="http://\\1" target="_blank">\\2</a>',
'<a href="http://\\1" target="_blank">\\1</a>',
'<img src="\\1" border="0">',
'<span style="font-size: \\1px;">\\2</span>',
'<span style="color: \\1;">\\2</span>',
'<div align="\\1">\\2</div>',
'\\\\'.'\n',
'<div align="center">\\1</div>',
'<img src="'.$faqimagesfold.'\\1" border="0">', //MY MOD
'<img src="'.$faqimagesfold.'\\2" border="0" alt="\\1" onMouseOver="'."self.status='\\1'; return(true);".'" onMouseOut="'."self.status=''; return(true);".'">'); //MY MOD
$ret = str_replace ("[quote]","<blockquote>",$ret);
$ret = str_replace ("[/quote]","</blockquote>",$ret);
$ret = preg_replace($pattern,$replace,$ret);
$ret = preg_replace_callback("#\[php\](.*)\[\/php\]#Usi","php_syntax", $ret);
$ret = preg_replace_callback("#\[code\](.*)\[\/code\]#Usi","code_syntax", $ret);
//MYMOD
$ret = preg_replace_callback("#\[lart=(.*) lang=(.*)]#Usi","link_aticle", $ret);
//MYMOD
$ret = str_replace('http://http://','http://',$ret);
return $ret;
}
/*
* Funktion for BB-Code | @@ Nick Georgakis, 2003-08-25
* Last Update:
*/
function link_aticle($output) {
global $db, $sqltblpre, $no_cats;
If (sizeof($output)!=3)
return "<i><b>Article Link Error</b></i>";
if (isset($_REQUEST["sid"])) {
$thsids = "sid=".$_REQUEST["sid"]."&";
}else{
$thsids ="";
}
$query = "SELECT ".$sqltblpre."faqdata.thema,".$sqltblpre."faqdata.rubrik FROM ".$sqltblpre."faqdata WHERE id = '".$output[1]."' AND lang = '".$output[2]."'";
$result = $db->query($query);
if ($db->num_rows($result) > 0) {
while ($row = $db->fetch_object($result)) {
return "<a href=\"".$_SERVER["PHP_SELF"]."?".$thsids."aktion=artikel&rubrik=".$row->rubrik."&id=".$output[1]."&lang=".$output[2]."\">".$row->thema."</a>";
}
}
else {
return "<i><b>Article not found</b></i>";
}
}

Add them to phpMyFAQ If you approve it.