Joomla galeri bileşenleri arasında en popüler olan bileşenler arasında gösterilen Datso Gallery, içinde de yer alan ek özelliği olan yorum bileşenleri ile entegre bir biçimde çalışabildiğini biliyoruz. Ancak Jcomments bileşeniyle bu entegreyi yapabileceği özelliği barındırmadığından sizlere JComment yorum bileşeninin datso galeriye nasıl entegre edilebileceğini anlatmaya çalışacağız.
Öncelikle Jcomments'in son sürümünü buradaki >> resmi sitesinden indirebileceğimizi belirtelim, ayrıca anlatımın orjinaline de yine aynı sitedeki buradaki >> linkten erişebilirsiniz. İsterseniz Jcomment ile Datso Gallery bileşenlerinin arasındaki köprülemenin nasıl yapılacağının anlatımına geçelim. Öncelikle üç tane dosya üzerinde çalışacağımızı belirtelim.
İlk olarak /components/com_datsogallery/datsogallery.php dizinindeki dosyamızı html düzenleme programlarından bir tanesiyle açalım ve aşağıdaki kodları bulalım;
$database->setQuery("SELECT cmtid FROM #__datsogallery_comments WHERE cmtpic='$row1->id'");
$comments_result = $database->query();
$comments = mysql_num_rows($comments_result);
Bu kod parçacıklarını aşağıdaki kod kümesi ile değiştirelim;
global $mosConfig_absolute_path; $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php'; if (file_exists($comments)) { require_once($comments); $comments = JComments::getCommentsCount($row1->id, 'com_datsogallery'); }
Şimdi de /components/com_datsogallery/sub_viewdetails.php dosyamızı açalım ve aşağıdaki kodu bulalım.
if ($ad_showcomment) {
Ardından bu kodumuzu geçersiz kılacak olan "/*" yorum işaretini ekleyelim, yanü üstteki kodumuzu alttaki kod ile değiştireceğiz.
/* if ($ad_showcomment) {
Aynı dosyada yine aşağıdaki kodu bulalım
if ($ad_showsend2friend) {
Ve bu kodu da aşağıdaki kod ile değiştirelim
*/ if ($ad_showsend2friend) {
Ve bu dosyamızdaki son değişikliğimizi yapacağız, aşağıdaki kodu yine aynı dosyamızda bulalım
?>
Ve bu kodumuzu aşağıdaki kod kümesi ile değiştirelim
if ($ad_showcomment) {
global $mosConfig_absolute_path;
$comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once($comments);
echo JComments::showComments($id, 'com_datsogallery', $imgtitle);
}
}
?>
Şimdi çalışacağımız son dosyamız olan /components/com_datsogallery/sub_viewspecial.php dosyamızı açalım ve aşağıdaki kodu bulalım
$database->setQuery("select cmtid from #__datsogallery_comments where cmtpic='$row1->id'");
$comments_result = $database->query();
$comments = mysql_num_rows($comments_result);
Bu kodları yine aşağıdaki kod kümesi ile değiştirelim
global $mosConfig_absolute_path;
$comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once($comments);
$comments = JComments::getCommentsCount($row1->id, 'com_datsogallery');
}
Ve son olarak da yine aynı dosyamızdaki aşağıdaki kodları bulalım
$database->setQuery("select a.*, cc.cmtid "
. " from #__datsogallery as a, #__datsogallery_comments "
. " as cc, #__datsogallery_catg "
. " as ca where a.id=cc.cmtpic "
. " and a.catid=ca.cid "
. " and a.published=1 "
. " and a.approved=1 "
. " and ca.published=1 "
. " and ca.access<=$gid "
. " order by cc.cmtid desc limit $ad_toplist ");
Bu kodları da aşağıdaki kod kümesi ile değiştirerek işlemlerimizi tamamlayalım.
$database->setQuery("select a.* "
. " from #__datsogallery as a"
. " inner join #__datsogallery_catg as ca on a.catid = ca.cid"
. " inner join #__jcomments as cc on a.id = cc.object_id"
. " where a.published=1 and a.approved=1 "
. " and cc.object_group='com_datsogallery' and cc.published=1 "
. " and ca.published=1 and ca.access<=$gid "
. " order by cc.date desc limit $ad_toplist ");

Adımları harfi harfine takip etmişsek bu aşamadan sonra JComment ile Datso Gallery birlikte çalışabilecek şekilde entegre edilmiş hale gelecektir. Bunu datso gallery bileşeninin ayarlar kısmından da görebiliri.









