Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 1 Ответов
  • 4134 Просмотров
*

Peroon

  • Захожу иногда
  • 247
  • 11 / 1
  • http://textonix.ru
Понадобилось решить две задачи:
1. Вывести список вложенных галерей в основном списке, да еще с превьюшками. Хотя бы на один уровень вглубину.
2. перейти на картинку которая стает ранодомом на заголовке галереи.

ну малость накропалось решение, не совсем может красивое, но функциональное:


в обеих разах корежим файло datsogallery.php. номера строк не привожу, так как мой вариант уже сильно угроблен моими шаловливыми ручками.
1:
Код
		?>
<script language="javascript" type="text/javascript">
   var request = false;
   try {
     request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         request = false;
       }  
     }
   }

   if (!request)
     alert("Error initializing XMLHttpRequest!");

   function getCustomerInfo1(catid, usr, custom_i) {
 
     var url = "<?php echo JURI::base(). "components/com_datsogallery/libraries/getgalinfo/subcatlist.php?catuserid="?> "+catid+"&usr="+usr+"&customi="+custom_i;
    
request.open("POST", url, true);
     request.onreadystatechange = function ()
{
     if (request.readyState == 4)
       if (request.status == 200)
{
  sElem = document.getElementById("txtCustomerInfo"+custom_i);
     sElem.innerHTML = request.responseText;
}
      
}

     request.send(null);

   }

</script>
<?php


//////////////////////////////////////////////////////////////////////
$num_rows_sub_Count = 0;
$query = " select d.*  from #__datsogallery_catg as d where d.parent=".$cur_name->cid." and d.published>='1' and access<='" . $user->get('aid'). "' order by d.ordering  ";
       $db->setQuery($query);
       $rows_sub_Count = $db->loadObjectList();
         $num_rows_sub_Count = count($rows_sub_Count);
if ($num_rows_sub_Count >0)
{
$output .= "<a href=\"#\" onClick=\"getCustomerInfo1('". $cur_name->cid  ."','".$user->name."','".$custom_i."');return false\"";

$output .= " >\n";

$output .= "<img src='".JURI::base()."components/com_datsogallery/images/i2.gif' alt=\"\" title=\""._DG_CAT_PREVIEW1 . _DG_CAT_PREVIEW2 .$num_rows_sub_Count . "\"/></a>\n\n";
}
//////////////////////////////////////////////////////////////////////

при этом надо не забыть добавить div:

Код
// Сама панель с подкатегориями
   $output .= "<div style = \"width: 90%; padding:0px 40px; border: 1px\" id=\"txtCustomerInfo".$custom_i."\"></div> ";

сразу после вывода строки галерей с описаниями и прочим.

в приложении есть файло по выводу вложенной галереи, эту гадысть нада положить в com_datsogallery\libraries\getgalinfo\

В файле есть несколько кривоватеньких кейсов, не удивляйтесь, это всего лишь эксперементы с провами доступа к имагам и разделам, на работу это ни как не повлияет.

2: тут все просто. Под превьюшкой галереи/раздела лепим что нить типа этого:

Код
$output .= "<a href=\"" . JRoute::_("index.php?option=com_datsogallery&func=detail&catid=" . $cur_name->cid . "&id=". $row2->id ."&Itemid=" . $Itemid). "\">\n";
$output .= "<img src=\"".JURI::base()."components/com_datsogallery/images/dg-i3.gif\" alt=\"\" border = 0 /></a>\n &nbsp;\n";

ну и офкос должны быть файлики кнопуль: dg-i3.gif и i2.gif, ну или как вы их там обзовете....


посмотреть в работе: http://textonix.ru/

по поводу работает не работает отвечать особо не буду, окромя случаев, когда забыл что то указать....

« Последнее редактирование: 24.02.2010, 16:20:19 от Peroon »
*

Peroon

  • Захожу иногда
  • 247
  • 11 / 1
  • http://textonix.ru
файло не вложилось посему вот файл subcatlist.php:

Код
<?php
//setlocale(LC_ALL, 'ru_RU.CP1251', 'rus_RUS.CP1251', 'UTF-8','Russian_Russia.1251', 'russian');
iconv_set_encoding('internal_encoding', 'UTF-8'); // Исходная кодировка файлов
iconv_set_encoding('output_encoding'  , 'UTF-8');        // Конечная кодировка
Error_Reporting (E_ERROR);

header('Content-Type: text/html; charset=UTF8');

 
define ( '_JEXEC', 1 );
define ( '_VALID_MOS', 1 );
define ( 'DS', DIRECTORY_SEPARATOR );
define ('JPATH_BASE', dirname (__FILE__).DS.'..'.DS.'..'.DS.'..'.DS.'..');
Error_Reporting (E_ERROR);


require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
require ( JPATH_BASE .DS.'administrator'.DS.'components'.DS.'com_datsogallery' . DS . 'config.datsogallery.php');
///libraries/joomla/base/observable.php
require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'base'.DS.'observable.php' );

$mainframe =& JFactory::getApplication ('site');
$mainframe->initialise ();
$mainframe->route ();

$GLOBALS['mosConfig_live_site'] = str_replace ('/components/com_datsogallery/libraries/getgalinfo/','',JURI::root ());

$mosConfig_live_site = str_replace ('/components/com_datsogallery/libraries/getgalinfo/','',JURI::root ());


  $lang =& JFactory::getLanguage();
  $datsolang = strtolower($lang->getBackwardLang());
  if (file_exists('..'. DS .  '..'. DS . 'language' . DS .  $datsolang . '.php')) {
    require_once ('..'. DS .  '..'. DS .  'language' . DS . 'russian.php');
  }
  else {
    require ('..'. DS .  '..'. DS . 'com_datsogallery' . DS . 'language' . DS . 'english.php');
}



$db = &JFactory::getDBO ();
//$tmp_editors = &JFactory::getEditor();

 
 
$folderGlobal=$_POST['pathsite'];
$result = array();
 
$result['time'] = date('r');
$result['addr'] = substr_replace(gethostbyaddr($_SERVER['REMOTE_ADDR']), '******', 0, 6);
$result['agent'] = $_SERVER['HTTP_USER_AGENT'];
 
if (count($_GET)) {
$result['get'] = $_GET;
}
if (count($_POST)) {
$result['post'] = $_POST;
}
if (count($_FILES)) {
$result['files'] = $_FILES;
}
 
// we kill an old file to keep the size small
if (file_exists('script1.log') && filesize('script1.log') > 102400) {
unlink('script1.log');
}
 
$log = @fopen('script1.log', 'a');
if ($log) {
fputs($log, print_r($result, true). "\n---\n");
fclose($log);
}

$catid_lst  = $result['get']['catuserid'];
$username = $result['get']['usr'];
$customi = $result['get']['customi'];
       

     //   
        $db = & JFactory::getDBO();
        $user = & JFactory::getUser();

        $thumbnailpath = $mosConfig_live_site . $ad_paththumbs . "/";

        $catid = $catid_lst;//JRequest::getVar('catid', 0, 'get', 'int');
        $Itemid = JRequest::getVar('Itemid', 0, 'get', 'int');
        $query = " select d.* from #__datsogallery_catg as d  where d.parent=".$catid." and d.published>='1' and access ='0' order by d.ordering desc  ";

        $db->setQuery($query);
        $rows = $db->loadObjectList();
        $num_rows = count($rows);
        $index = 0;
        if ($ad_ncsc > $num_rows) {
          $ad_ncsc = $num_rows;
        }
        else {
          $ad_ncsc = $ad_ncsc;
        }

if ($ad_ncsc){
$cw = 100/$ad_ncsc."%";
$colspan = $ad_ncsc * 2;
}

        $output .= "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n";
        if (@ $rows[0]->parent) {
          $query = " select d.* " . " from #__datsogallery_catg as d " . " where d.cid=".$catid." and d.published>='1' and access<='" . $user->get('aid'). "' " . " order by d.ordering desc ";
        $db->setQuery($query);
        $rowscat = $db->loadObjectList();
          $output .= "<tr><td align=\"left\" colspan=\"" . $colspan . "\" class=\"sectiontableheader\"> ". $rowscat[0]->name .", ". _DG_SUBCATEGORIES . "</td></tr>\n";
        }
        else
          if (@ $rows[0]->cid) {
            $output .= "<tr><td align=\"left\" colspan=\"" . $colspan . "\" class=\"sectiontableheader\">" .  _DG_CATEGORIES . "</td></tr>\n";
          }
          if ($num_rows)
            for ($row_count = 0; $row_count < ($num_rows / $ad_ncsc); $row_count++) {

              $output .= "<tr class=\"sectiontableentry2\">\n";
              for ($i = 0; $i < $ad_ncsc; $i++) {
                $cur_name = @ $rows[$index];
                $output .= "<td align=\"center\" valign=\"middle\">\n";
$custom_i = 0;
                if (!@ $cur_name->cid) {
                  $output .= "</td><td>&nbsp;</td>\n";
                }
                else {
                  $catid = $cur_name->cid;
                  $query = "select *, c.access from #__datsogallery as p " . " left join #__datsogallery_catg as c on c.cid=p.catid " . " where " . ($catid ? " ( p.catid in (" . $catid . ") )":''). " and p.published >= '0' and p.approved='1' and c.access ='0' " . " || " . ($catid ? " ( c.parent in (" . $catid . ") )":''). " and p.published >= '0' and p.approved='1' and c.access ='0' " . " order by rand() limit 1";
                  $db->setQuery($query);
                  $rows2 = $db->loadObjectList();
                  $row2 = & $rows2[0];
                  $db->setQuery($query);
                  $count = $db->loadResult();
                  if ($count > 0)
  {
  $fl_Ok = FALSE;
/////////////////////////////////// 
$FlPublished = intval($cur_name->published);
switch (@ $FlPublished)
{
case '1':
$fl_Ok = TRUE;
break;
case '2':
if ($username)
{
$fl_Ok = TRUE;
}
else
{
$fl_Ok = FALSE;
}

break;
case '3':
$ac_user_name = $row2->owner;
if ($ac_user_name == $username)
{
$fl_Ok = TRUE;
}
else
{
$fl_Ok = FALSE;
}

break;
  }
/////////////////////////////////// 
if ($fl_Ok)
{
$output .= '<a href="' . JRoute::_( "../../../../../index.php?option=com_datsogallery&func=viewcategory&catid=" . $cur_name->cid . "&Itemid=" . $Itemid). '">';
$output .= '<img src="' . $thumbnailpath . $row2->imgthumbname . '" id="dg-image" title="' . _DG_OPEN_CAT . '" alt="" /></a>';
$output .= "<br /> <br />";
$output .= "<a href=\"" . JRoute::_("../../../../../index.php?option=com_datsogallery&func=detail&catid=" . $cur_name->cid . "&id=". $row2->id ."&Itemid=" . $Itemid). "\">\n";
$output .= "<img src=\"".JURI::base()."../../../../../components/com_datsogallery/images/dg-i3.gif\" alt=\"\" border = 0/></a>\n &nbsp;\n";

}
else
{
$output .= "<img src='".JURI::base()."components/com_datsogallery/images/accessdenied.gif'  width=".$ad_thumbwidth."  height=".$ad_thumbheight." id=\"dg-image\" title=\"" . _DG_OPEN_CAT . "\" alt=\"\" />";

}
$output .= "</td>";


$output .= '<td class="sectiontableentry2" align="left" valign="top" width="' . $cw . '">';
                  }
                  else
                    if (GetThumbsInCats($cur_name->cid)) {
                      $output .= '<img src="' . $thumbnailpath . GetThumbsInCats($cur_name->cid). '" id="dg-image" title="' . _DG_OPEN_CAT . '" alt="" /></a></td>';
                      $output .= '<td class="sectiontableentry2" align="left" valign="top" width="' . $cw . '">';
                    }
                    else
                      if (!$count) {
                        $output .= '<div style="background:url(' . JURI::base(). '/components/com_datsogallery/images/blank.gif) no-repeat;display:block;background-position: 50% 50%;width:' . $ad_thumbwidth . 'px;height:' . $ad_thumbheight . 'px"></div></td>';
                        $output .= '<td class="sectiontableentry2" align="left" valign="top" width="' . $cw . '">';
                      }
                }
             //  Генерим ссылки и описание категории 
if ($cur_name && ($count) || (GetThumbsInCats(@ $cur_name->cid)))
{
$fl_Ok = FALSE;
$FlPublished = intval($cur_name->published);
///////////////////////////////////////
switch (@ $FlPublished)
{
case '1':
$fl_Ok = TRUE;
break;
case '2':
if ($username)
{
$fl_Ok = TRUE;
}
else {$fl_Ok = FALSE; }
break;
case '3':

$ac_user_name = $row2->owner;
if ($ac_user_name == $username)
{
$fl_Ok = TRUE;
}
else {$fl_Ok = FALSE; }
break;
}
///////////////////////////////////////////
if ($fl_Ok)
{
$output .= '<a href="' . JRoute::_("../../../../../index.php?option=com_datsogallery&func=viewcategory&catid=" . @ $cur_name->cid . "&Itemid=" . $Itemid). '">';
                  $output .= '<strong>' . @ $cur_name->name . '</strong></a>';
}
else {$output .= '<strong>' .@ $cur_name->name . '</strong>';}

                }
                else
                  if ($cur_name) {
                    $output .= '<strong>' . $cur_name->name . '</strong>';
                  }
                  if (@ $cur_name->name) {

                    if ($ad_showinformer) {

                    }
                    $output .= '</span>';
                  }
                  $output .= '<br />' . @ $cur_name->description . '</td>';
                $index++;
              }
              $output .= '</tr>';
 
// echo "<div id=\"txtCustomerInfo".$custom_i."\"></div>";
  $custom_i++;
 
        }
        $output .= '</table>';
        if (@ $rows[0]->parent) {
          $parcid = $rows[0]->parent;
          if ($total > $ad_catsperpage) {
            $output .= "<div align='center'>";
            $output .= $pageNav->getPagesLinks("../../../../../index.php?option=com_datsogallery&func=viewcategory&catid=" . $parcid . "&Itemid=" . $Itemid);
            $output .= "</div>";
          }
        }
        elseif (@ $rows[0]->cid) {
          if ($total > $ad_catsperpage) {
            $output .= "<div align='center'>";
            $output .= $pageNav->getPagesLinks("../../../../../index.php?option=com_datsogallery&Itemid=" . $Itemid);
            $output .= "</div>";
          }
        }



echo $output;

//echo "<a href=\"#\" id=\"toggle\">Закрыть</a>";
  ////////////////////////////////////////////////////////////////////////////////////////////
  // GetThumbsInCats
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      function GetThumbsInCats($cat) {
        $db = & JFactory::getDBO();
        $queue[] = intval($cat);
        while (list($key, $cat) = each($queue)) {
          $db->setQuery("select cid from #__datsogallery_catg where parent=$cat and published=1");
          $result = $db->query();
          $total = mysql_num_rows($result);
          $j = 0;
          while ($j < $total) {
            $val = mysql_fetch_row($result);
            $queue[] = $val[0];
            $j++;
          }
        }
        reset($queue);
        $query = "select imgthumbname from #__datsogallery  where ( 0!=0";
        while (list($key, $cat) = each($queue)) {
          $query .= " or catid = $cat";
        }
        $query = $query . " ) and published=1 and approved = 1 order by rand() limit 1";
        $db->setQuery($query);
        $result = $db->query();
        $thumb = mysql_fetch_row($result);
        return $thumb[0];
      }

?>
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

mod_snx_scroller_datsogallery горизонтальный вывод изображений?

Автор arashvg

Ответов: 0
Просмотров: 3662
Последний ответ 09.07.2010, 13:26:35
от arashvg