Форум русской поддержки Joomla!® CMS
09.12.2016, 04:00:55 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
   
   Начало   Поиск Joomla 3.0 FAQ Joomla 2.5 FAQ Joomla 1.5 FAQ Правила форума Новости Joomla Реклама Войти Регистрация Помощь  
Страниц: [1]   Вниз
  Добавить закладку  |  Печать  
Автор

Xmap неправильно генерирует ссылки

 (Прочитано 2241 раз)
0 Пользователей и 1 Гость смотрят эту тему.
c_zurab
Осваиваюсь на форуме
***

Репутация: +0/-0
Offline Offline

Сообщений: 79


« : 11.12.2011, 16:11:37 »

помогите пожалуйста..
уже пару дней пытаюсь найти решение, но никак не получаеться устранить проблему.
дело в том что использую xmpa для создания карты и plugin zoo
но ссылка получаеться вот такая:
/component/zoo/item/files  -  .xml
а на самом деле ссылка выглядет вот так
/category/item/files

подскажите что можно сделать
заранее всем спасибо
Записан
c_zurab
Осваиваюсь на форуме
***

Репутация: +0/-0
Offline Offline

Сообщений: 79


« Ответ #1 : 11.12.2011, 17:04:14 »

http://joomlaforum.ru/index.php/topic,152825.0.html
нашел похожую проблему но не для зуу
в PHP я не очень то понимаю
может кто поможет?

в плагин для зуу есть такой файлик, который думаю отвечает как выводить ссылки
может тут ченить надо поправить?

<?php
/**
* @author Bojan Popic
* @email bojanpopic@gmail.com
* @version $Id: com_zoo.php
* @package Xmap
* @license GNU/GPL
* @description Xmap plugin for YooThemes Zoo component
*/

/* Usefull tips

Requirement:
- one menu item that point to frontpage of zoo application.

If you have menu items that points to zoo categories, it will duplicate entry since zoo
is "one item - multi categories" CCK.
You should exclude that menu items from map, and use the one from requirements. If you
don't need that kind of menu item, just make one and unpublish it, it would serve fine
for map, and it would not mess up your menu.

/**
CHANGELOG
BETA5
- found and fixed bug - using jos_ prefix in item fetch SQL code. Changed prefix to #_. Thanks thibaut.lauziere for founding that bug!

BETA4
- added news map creation. Previous versions didn't create news map at all. Thanks ioalex for tips about problem and solution!

BETA3
- Removed some redundant code
- Added possibility (2 new parameters) to print title in HTML map before listing categories/items.

BETA2
- Fixed printing links from all zoo applications. Now it prints what application is selected in menu item parameters.

BETA1
- Intial release
*/
defined( '_JEXEC' ) or die( 'Restricted access.' );

class xmap_com_zoo {

   /*
   * This function is called before a menu item is printed. We use it to set the
   * proper uniqueid for the item and indicate whether the node is expandible or not
   */
   function prepareMenuItem(&$node) {
      $link_query = parse_url( $node->link );
      parse_str( html_entity_decode($link_query['query']), $link_vars);
      $component = JArrayHelper::getValue($link_vars, 'option', '');
      $view = JArrayHelper::getValue($link_vars,'view','');
      // it only works if there is menu item that is set on zoo, and on frontpage view
      // it will parse that menu item and ignore others
      if ($component == 'com_zoo' && $view == 'frontpage' ) {
         $id = intval(JArrayHelper::getValue($link_vars,'id',0));
         if ( $id != 0 ) {
            $node->uid = 'zoo'.$id;
            $node->expandible = false;
         }
      }
   }

   function getTree( &$xmap, &$parent, &$params) {
      
      $link_query = parse_url( $parent->link );
      parse_str( html_entity_decode($link_query['query']), $link_vars );
      $view = JArrayHelper::getValue($link_vars,'view',0);

      $include_categories = JArrayHelper::getValue( $params, 'include_categories',1,'' );
      $include_categories = ( $include_categories == 1
              || ( $include_categories == 2 && $xmap->view == 'xml')
              || ( $include_categories == 3 && $xmap->view == 'html')
              ||   $xmap->view == 'navigator');
      $params['include_categories'] = $include_categories;
            
      $include_items = JArrayHelper::getValue( $params, 'include_items',1,'' );
      $include_items = ( $include_items == 1
              || ( $include_items == 2 && $xmap->view == 'xml')
              || ( $include_items == 3 && $xmap->view == 'html')
              ||   $xmap->view == 'navigator');
      $params['include_items'] = $include_items;

      $priority = JArrayHelper::getValue($params,'cat_priority',$parent->priority,'');
      $changefreq = JArrayHelper::getValue($params,'cat_changefreq',$parent->changefreq,'');
      if ($priority  == '-1')
         $priority = $parent->priority;
      if ($changefreq  == '-1')
         $changefreq = $parent->changefreq;

      $params['cat_priority'] = $priority;
      $params['cat_changefreq'] = $changefreq;

      $priority = JArrayHelper::getValue($params,'item_priority',$parent->priority,'');
      $changefreq = JArrayHelper::getValue($params,'item_changefreq',$parent->changefreq,'');
      if ($priority  == '-1')
         $priority = $parent->priority;

      if ($changefreq  == '-1')
         $changefreq = $parent->changefreq;

      $params['item_priority'] = $priority;
      $params['item_changefreq'] = $changefreq;

      xmap_com_zoo::getCategoryTree($xmap, $parent, $params);

   }

   function getCategoryTree ( &$xmap, &$parent, &$params) {
      $db = &JFactory::getDBO();
      
      // first we fetch what application we are talking about
      
      $menu =& JSite::getMenu();
      $menuparams = $menu->getParams($parent->id);
      $appid =  intval($menuparams->get('application', 0));
      
      // if selected, we print title category
      if ($params['include_categories']) {
         
         // we print title if there is any
         if ($params['categories_title'] != "" && $xmap->view == 'html') {
            echo "<".$params['categories_title_tag'].">".$params['categories_title']."</".$params['categories_title_tag'].">";
         }
         // get categories info from database
         $queryc = 'SELECT c.id, c.name '.
                'FROM #__zoo_category c '.
                ' WHERE c.application_id = '.$appid.' AND c.published=1 '.
                ' ORDER by c.ordering';
         
         $db->setQuery($queryc);
         $cats = $db->loadObjectList();
         
         // now we print categories
         $xmap->changeLevel(1);
         foreach($cats as $cat) {
            $node = new stdclass;
            $node->id   = $parent->id;
            $node->uid  = $parent->uid .'c'.$cat->id;
            $node->name = $cat->name;
            $node->link = 'index.php?option=com_zoo&amp;task=category&amp;category_id='.$cat->id;
            $node->priority   = $params['cat_priority'];
            $node->changefreq = $params['cat_changefreq'];
            $node->expandible = true;
            $xmap->printNode($node);
         }
         $xmap->changeLevel(-1);
      }

      if ($params['include_items'] ){
      
         if ($params['items_title'] != "" && $xmap->view == 'html') {
            echo "<".$params['items_title_tag'].">".$params['items_title']."</".$params['items_title_tag'].">";
         }
         // get items info from database
         // basically it select those items that are published now (publish_up is less then now, meaning it's in past)
         // and not unpublished yet (either not have publish_down date set, or that date is in future)
         $queryi =  'SELECT i.id, i.name, i.publish_up'.
                     ' FROM #__zoo_item i'.
                     ' WHERE i.application_id= '.$appid.
                     ' AND DATEDIFF( i.publish_up, NOW( ) ) <=0'.
                     ' AND IF( i.publish_down >0, DATEDIFF( i.publish_down, NOW( ) ) >0, true )'.
                     ' ORDER BY i.publish_up';
         $db->setQuery($queryi);
         $items = $db->loadObjectList();
         
         // now we print items
         $xmap->changeLevel(1);
         foreach($items as $item) {
            // if we are making news map, we should ignore items older then 3 days
            if ($xmap->isNews && strtotime($item->publish_up) < ($xmap->now - (3 * 86400))) {
                    continue;
                }
            $node = new stdclass;
            $node->id   = $parent->id;
            $node->uid  = $parent->uid .'i'.$item->id;
            $node->name = $item->name;
            $node->link = 'index.php?option=com_zoo&amp;task=item&amp;item_id='.$item->id;
            $node->priority   = $params['item_priority'];
            $node->changefreq = $params['item_changefreq'];
            $node->expandible = true;
            $node->modified = strtotime($item->publish_up);
            $node->newsItem = 1; // if we are making news map and it get this far, it's news
            $xmap->printNode($node);
            
            
         }
         $xmap->changeLevel(-1);
      }
   }

}
Записан
c_zurab
Осваиваюсь на форуме
***

Репутация: +0/-0
Offline Offline

Сообщений: 79


« Ответ #2 : 13.12.2011, 14:13:49 »

неужели никто не сталкивался с такой проблемой?
Записан
Abiladenda
Осваиваюсь на форуме
***

Репутация: +5/-0
Offline Offline

Сообщений: 187



« Ответ #3 : 18.02.2012, 15:02:44 »

Обрыл все в том числе на буржуйских сайтах и форумах ставил 3-4 разных плагина везде остается component/zoo в ссылках, пока решения нет, получается что нельзя пока ставить Joomla 2.5 и zoo, нужно ждать.
Записан
liten
Осваиваюсь на форуме
***

Репутация: +5/-0
Offline Offline

Пол: Женский
Сообщений: 34


не забываем про + и -


« Ответ #4 : 15.09.2015, 19:11:49 »

Решает проблему с /component/zoo/ но не убирает item
Код:
<?php

defined( '_JEXEC' ) or die( 'Restricted access.' );

class xmap_com_zoo {

function prepareMenuItem(&$node) {
$link_query = parse_url( $node->link );
parse_str( html_entity_decode($link_query['query']), $link_vars);
$component = JArrayHelper::getValue($link_vars, 'option', '');
$view = JArrayHelper::getValue($link_vars,'view','');


if ($component == 'com_zoo' && $view == 'frontpage' ) {
$id = intval(JArrayHelper::getValue($link_vars,'id',0));
if ( $id != 0 ) {
$node->uid = 'zoo'.$id;
$node->expandible = false;
}
}
}

function getTree( &$xmap, &$parent, &$params) {

$link_query = parse_url( $parent->link );
parse_str( html_entity_decode($link_query['query']), $link_vars );
$view = JArrayHelper::getValue($link_vars,'view',0);

$include_categories = JArrayHelper::getValue( $params, 'include_categories',1,'' );
$include_categories = ( $include_categories == 1
  || ( $include_categories == 2 && $xmap->view == 'xml')
  || ( $include_categories == 3 && $xmap->view == 'html')
  ||   $xmap->view == 'navigator');
$params['include_categories'] = $include_categories;

$include_items = JArrayHelper::getValue( $params, 'include_items',1,'' );
$include_items = ( $include_items == 1
  || ( $include_items == 2 && $xmap->view == 'xml')
  || ( $include_items == 3 && $xmap->view == 'html')
  ||   $xmap->view == 'navigator');
$params['include_items'] = $include_items;

$priority = JArrayHelper::getValue($params,'cat_priority',$parent->priority,'');
$changefreq = JArrayHelper::getValue($params,'cat_changefreq',$parent->changefreq,'');
if ($priority  == '-1')
$priority = $parent->priority;
if ($changefreq  == '-1')
$changefreq = $parent->changefreq;

$params['cat_priority'] = $priority;
$params['cat_changefreq'] = $changefreq;

$priority = JArrayHelper::getValue($params,'item_priority',$parent->priority,'');
$changefreq = JArrayHelper::getValue($params,'item_changefreq',$parent->changefreq,'');
if ($priority  == '-1')
$priority = $parent->priority;

if ($changefreq  == '-1')
$changefreq = $parent->changefreq;

$params['item_priority'] = $priority;
$params['item_changefreq'] = $changefreq;

xmap_com_zoo::getCategoryTree($xmap, $parent, $params);

}

function getCategoryTree ( &$xmap, &$parent, &$params) {
$db = &JFactory::getDBO();

// first we fetch what application we are talking about

$menu =& JSite::getMenu();
$menuparams = $menu->getParams($parent->id);
$appid =  intval($menuparams->get('application', 0));

// if selected, we print title category
if ($params['include_categories']) {

// get categories info from database
$queryc = 'SELECT c.id, c.name '.
'FROM #__zoo_category c '.
' WHERE c.application_id = '.$appid.' AND c.published=1 '.
' ORDER by c.ordering';

$db->setQuery($queryc);
$cats = $db->loadObjectList();

// now we print categories
$xmap->changeLevel(1);
foreach($cats as $cat) {
$node = new stdclass;
$node->id   = $parent->id;
$node->uid  = $parent->uid .'c'.$cat->id;
$node->name = $cat->name;
$node->link = 'index.php?option=com_zoo&amp;task=category&amp;category_id='.$cat->id.'&amp;Itemid='.$parent->id;//10.08.2013 20:14 denver
$node->priority   = $params['cat_priority'];
$node->changefreq = $params['cat_changefreq'];
$node->expandible = true;
$xmap->printNode($node);


if ($params['include_items'] ){

// get items info from database
// basically it select those items that are published now (publish_up is less then now, meaning it's in past)
// and not unpublished yet (either not have publish_down date set, or that date is in future)
$queryi =  'SELECT i.id, i.name, i.publish_up'.
' FROM #__zoo_item i'.
' WHERE i.application_id= '.$appid.
' AND DATEDIFF( i.publish_up, NOW( ) ) <=0'.
' AND IF( i.publish_down >0, DATEDIFF( i.publish_down, NOW( ) ) >0, true )'.
' ORDER BY i.publish_up';
$db->setQuery($queryi);
$items = $db->loadObjectList();

// now we print items
$xmap->changeLevel(1);

foreach($items as $item) {
// if we are making news map, we should ignore items older then 3 days
if ($xmap->isNews && strtotime($item->publish_up) < ($xmap->now - (3 * 86400))) {
                    continue;
                }
$node = new stdclass;
$node->id   = $parent->id;
$node->uid  = $parent->uid .'i'.$item->id;
$node->name = $item->name;
$node->link = 'index.php?option=com_zoo&amp;task=item&amp;item_id='.$item->id.'&amp;Itemid='.$parent->id;//10.08.2013 20:14 denver;
$node->priority   = $params['item_priority'];
$node->changefreq = $params['item_changefreq'];
$node->expandible = true;
$node->modified = strtotime($item->publish_up);
$node->newsItem = 1; // if we are making news map and it get this far, it's news
$xmap->printNode($node);


}
$xmap->changeLevel(-1);
}
}
$xmap->changeLevel(-1);
}
}

}
« Последнее редактирование: 17.09.2015, 18:55:50 от liten » Записан
liten
Осваиваюсь на форуме
***

Репутация: +5/-0
Offline Offline

Пол: Женский
Сообщений: 34


не забываем про + и -


« Ответ #5 : 17.09.2015, 18:55:08 »

Решение проблемы найдено http://joomlaforum.ru/index.php/topic,123887.msg1584869.html#msg1584869
Записан
Страниц: [1]   Вверх
  Добавить закладку  |  Печать  
 
Перейти в:  

Powered by SMF 1.1.21 | SMF © 2006, Simple Machines

Joomlaforum.ru is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters
the trademark holder in the United States and other countries.

LiveInternet