Titre du sujet : Re: Quelques modification du module mylink par babouille sur 17/09/2006 12:19:06
Voici mon singlelink.php, tout en pensant que tu n'as pas du déclarer ta varible liendur dans le passage des données vers ton template ($xoopsTpl->assign) :
include "header.php";
$myts =& MyTextSanitizer::getInstance();// MyTextSanitizer object
include_once XOOPS_ROOT_PATH."/class/xoopstree.php";
$mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"),"cid","pid");
$lid = intval($HTTP_GET_VARS['lid']);
$cid = intval($HTTP_GET_VARS['cid']);
$xoopsOption['template_main'] = 'mylinks_singlelink.html';
include XOOPS_ROOT_PATH."/header.php";
$result = $xoopsDB->query("select l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description from ".$xoopsDB->prefix("mylinks_links")." l, ".$xoopsDB->prefix("mylinks_text")." t where l.lid=$lid and l.lid=t.lid and status>0");
list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result);
$pathstring = "<a href='index.php'>"._MD_MAIN."</a> : ";
$pathstring .= $mytree->getNicePathFromId($cid, "title", "viewcat.php?op=");
$xoopsTpl->assign('category_path', $pathstring);
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {
$adminlink = '<a href="'.XOOPS_URL.'/modules/mylinks/admin/?op=modLink&lid='.$lid.'"><img src="'.XOOPS_URL.'/modules/mylinks/images/editicon.gif" border="0" alt="'._MD_EDITTHISLINK.'" /></a>';
} else {
$adminlink = '';
}
if ($votes == 1) {
$votestring = _MD_ONEVOTE;
} else {
$votestring = sprintf(_MD_NUMVOTES,$votes);
}
if ($xoopsModuleConfig['useshots'] == 1) {
$xoopsTpl->assign('shotwidth', $xoopsModuleConfig['shotwidth']);
$xoopsTpl->assign('tablewidth', $xoopsModuleConfig['shotwidth'] + 10);
$xoopsTpl->assign('show_screenshot', true);
$xoopsTpl->assign('lang_noscreenshot', _MD_NOSHOTS);
}
$path = $mytree->getPathFromId($cid, "title");
$path = substr($path, 1);
$path = str_replace("/"," <img src='".XOOPS_URL."/modules/mylinks/images/arrow.gif' board='0' alt=''> ",$path);
$path2 = $mytree->getPathFromId($cid, "title");
$path2 = substr($path2, 1);
$path2 = str_replace("/"," : ",$path2);
$new = newlinkgraphic($time, $status);
$pop = popgraphic($hits);
$xoopsTpl->assign('link', array('id' => $lid, 'cid' => $cid, 'rating' => number_format($rating, 2),'liendur' => $url, 'titretitle' => $ltitle, 'title' => $myts->makeTboxData4Show($ltitle).$new.$pop, 'category' => $path, 'logourl' => $myts->makeTboxData4Show($logourl), 'updated' => formatTimestamp($time,"m"), 'description' => $myts->makeTareaData4Show($description,0), 'adminlink' => $adminlink, 'hits' => $hits, 'votes' => $votestring, 'comments' => $comments, 'mail_subject' => rawurlencode(sprintf(_MD_INTRESTLINK,$xoopsConfig['sitename'])), 'mail_body' => rawurlencode(sprintf(_MD_INTLINKFOUND,$xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/mylinks/singlelink.php?lid='.$lid)));
$xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC);
$xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC);
$xoopsTpl->assign('lang_hits', _MD_HITSC);
$xoopsTpl->assign('lang_rating', _MD_RATINGC);
$xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE);
$xoopsTpl->assign('lang_reportbroken', _MD_REPORTBROKEN);
$xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND);
$xoopsTpl->assign('lang_modify', _MD_MODIFY);
$xoopsTpl->assign('lang_category' , _MD_CATEGORYC);
$xoopsTpl->assign('lang_visit' , _MD_VISIT);
$xoopsTpl->assign('lang_comments' , _COMMENTS);
// Page Title Hack by Xoops-France
$module_name = $myts->makeTboxData4Show($xoopsModule->getVar('name'));
//$xoopsTpl->assign('xoops_pagetitle', $module_name. ' - ' .$myts->makeTboxData4Show($path2).' - '.$myts->makeTboxData4Show($ltitle));
$xoopsTpl->assign('xoops_pagetitle', $myts->makeTboxData4Show($ltitle). ' - ' .$myts->makeTboxData4Show($path2).' - '.$module_name);
include_once XOOPS_ROOT_PATH . '/modules/mylinks/include/functions.php';
$xoopsTpl->assign('xoops_meta_keywords', mylinks_extract_keywords($description));
$xoopsTpl->assign('xoops_meta_description', $myts->makeTboxData4Show($ltitle).$cattitle);
// End Page Title Hack by Xoops-France & Hervé Thouzard
include XOOPS_ROOT_PATH.'/include/comment_view.php';
include XOOPS_ROOT_PATH.'/footer.php';
Et pour les templates la modif de mylinks_link.html:
<table class="outer" width='100%' cellspacing='0'>
<tr>
<td class="head" colspan='2' align='left' height="18"><{$lang_category}> <{$link.category}></td>
</tr>
<tr>
<td class="even" width='60%' align='left' valign="bottom"><a href='visit.php?cid=<{$link.cid}>&lid=<{$link.id}>' target='_blank'><img src='images/link.gif' border='0' alt='<{$lang_visit}>'><b><{$link.title}></b></a></td>
<td class="even" align='right' width='40%'><b><{$lang_lastupdate}></b><{$link.updated}></td>
</tr>
<tr>
<td class="odd" colspan='2' align='left'><{$link.adminlink}><b><{$lang_description}></b><br />
<a href="<{$xoops_url}>/modules/mylinks/visit.php?cid=<{$link.cid}>&lid=<{$link.id}>" target="_blank"><img src="http://www.thumbzor.com/tel.php?url=<{$link.liendur}>&remplace=<{$xoops_url}>/modules/mylinks/images/thumbshot.gif" width="<{$shotwidth}>" alt="" align="right" vspace="3" hspace="7"/></a>
<div style="text-align: justify"><{$link.description}></div><br /></td>
</tr>
<tr>
<td class="even" colspan='2' align='center'><b><{$lang_hits}></b><{$link.hits}> <b> <{$lang_rating}></b><{$link.rating}> (<{$link.votes}>)</td>
</tr>
<tr>
<td class="foot" colspan='2' align='center'><a href="<{$xoops_url}>/modules/mylinks/ratelink.php?cid=<{$link.cid}>&lid=<{$link.id}>"><{$lang_ratethissite}></a> | <a href="<{$xoops_url}>/modules/mylinks/modlink.php?lid=<{$link.id}>"><{$lang_modify}></a> |<a href="<{$xoops_url}>/modules/mylinks/brokenlink.php?lid=<{$link.id}>"><{$lang_reportbroken}></a> | <a target="_top" href="mailto:?subject=<{$link.mail_subject}>&body=<{$link.mail_body}>"><{$lang_tellafriend}></a> | <a href="<{$xoops_url}>/modules/mylinks/singlelink.php?cid=<{$link.cid}>&lid=<{$link.id}>"><{$lang_comments}> (<{$link.comments}>)</a></td>
</tr>
</table>
|