Как убрать генерацию ссылки категории PHP

Тема в разделе "Программирование", создана пользователем Balanar, 19.02.2015.

  1. Offline

    Balanar Пользователь

    Регистрация:
    22.01.2015
    Сообщения:
    57
    Симпатии:
    0
    Пол:
    Мужской
    Как убрать генерацию ссылки категории PHP?

    Вот сама ссылка:

    Код (PHP):
    1. <a href="<?php echo $item->link; ?>"><?php echo $item->text; ?></a><br />


    А вот целый файл:

    Код (PHP):
    1. <?php
    2. /**
    3. * @package Joomla! 1.5.x
    4. * @author 2008 (c)  Denys Nosov (aka Dutch)
    5. * @author web-site: www.joomla-ua.org
    6. * @copyright This module is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.
    7. **/
    8.  
    9. /*******************PARAMS****************/
    10. /*
    11. /* $params->get('moduleclass_sfx') - module class suffix
    12. /*
    13. /* $item->link  -  display link
    14. /* $item->text  -  display title
    15. /*
    16. /* $item->image  -  display image
    17. /*
    18. /* $item->created  -  display date & time
    19. /* $item->df_d  -  display day
    20. /* $item->df_m  -  display mounth
    21. /* $item->df_y  -  display mounth
    22. /*
    23. /* $item->author  -  display author
    24. /*
    25. /* $item->sectitle  -  display Section title
    26. /* $item->cattitle  -  display Category title
    27. /*
    28. /* $item->hits  -  display Hits
    29. /*
    30. /* $item->introtext  -  display introtex
    31. /* $item->fulltext  -  display fulltext
    32. /* $item->readmore  -  display Read more...
    33. /* $item->rmtext  -  display Read more... text
    34. /*
    35. /* $item->comments  - display comments
    36. /*
    37. /*****************************************/
    38.  
    39. // no direct access
    40. defined('_JEXEC') or die('Restricted access');
    41.  
    42. ?>
    43. <div class="junewsultra<?php echo $params->get('moduleclass_sfx'); ?>">
    44. <?php foreach ($list as $item) :  ?>
    45.    <div class="junews">
    46.   <?php if($item->text): ?>
    47.       <a href="<?php echo $item->link; ?>"><?php echo $item->text; ?></a><br />
    48.   <?php endif; ?>
    49.  
    50.   <?php if($params->get('pik')): ?>
    51.        <?php echo $item->image; ?><br />
    52.   <?php endif; ?>
    53.  
    54.   <div class="small juinfo">
    55.    
    56.   <?php if($params->get('showcat')): ?>
    57.          <?php echo $item->cattitle; ?>
    58.   <?php endif; ?>
    59.    
    60.   </div>
    61.  
    62.   <div class="small juinfo">
    63.   <?php if($params->get('showsec')): ?>
    64.          <?php echo $item->sectitle; ?>&nbsp;|&nbsp;
    65.   <?php endif; ?>
    66.   <?php if($params->get('showDate')): ?>
    67.          <?php echo $item->created; ?>
    68.   <?php endif; ?>
    69.    
    70.    
    71.   <?php if($params->def('avtor')): ?>
    72.          <?php echo $item->author; ?>
    73.   <?php endif; ?>
    74.   <?php if($params->get('showHits')): ?>
    75.          Просмотров: <?php echo $item->hits; ?>
    76.   <?php endif; ?>
    77.   </div>
    78.  
    79.   <?php if($params->get('show_intro')): ?>
    80.   <?php echo $item->introtext; ?>
    81.   <?php endif; ?>
    82.  
    83.   <?php if($params->get('read_more')): ?>
    84.   <a href="<?php echo $item->readmore; ?>" class="readmore<?php echo $params->get('moduleclass_sfx'); ?>" title="<?php echo $item->text; ?>"><?php echo $item->rmtext; ?></a>
    85.   <?php endif; ?>
    86.  
    87.   <?php if($params->def('JC')): ?>
    88.   <?php echo $item->comments; ?>
    89.   <?php endif; ?>
    90.    </div>
    91. <?php endforeach; ?>
    92. </div>


    Вот еще файл:

    Код (PHP):
    1. <?php
    2. /**
    3. * @package Joomla! 1.5.x
    4. * @author 2008-2010 (c)  Denys Nosov (aka Dutch)
    5. * @author web-site: www.joomla-ua.org
    6. * @copyright This module is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License.
    7. **/
    8.  
    9. // no direct access
    10. defined('_JEXEC') or die('Restricted access');
    11.  
    12. error_reporting(0);
    13.  
    14. require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
    15.  
    16. class modJUNewsUltraHelper {
    17.  
    18.    function getList(&$params) {
    19.  
    20.      global $mainframe;
    21.  
    22.      $db       =& JFactory::getDBO();
    23.      $user     =& JFactory::getUser();
    24.      $userId     = (int) $user->get('id');
    25.  
    26.      $count     = (int) $params->get('count', 5);
    27.  
    28.   $selekt_secid_catid = $params->def('selekt_secid_catid', '1') ;
    29.   $catid_select  = trim( $params->get( 'catid_select' ) );
    30.   $secid_select  = trim( $params->get( 'secid_select' ) );
    31.   $catid_text  = trim( $params->get( 'catid_text' ) );
    32.   $secid_text  = trim( $params->get( 'secid_text' ) );
    33.  
    34.  
    35.   $show_frontpage    = $params->get('show_frontpage', 1);
    36.      $aid      = $user->get('aid', 0);
    37.  
    38.   //INTRO
    39.   $show_intro  = $params->get( 'show_intro');
    40.   $introtext_limit  = intval( $params->get( 'introtext_limit', '10') );
    41.   $li  = $params->def('li', '1');
    42.   $lmttext  = $params->def('lmttext', '1');
    43.   $clear_tag  = $params->def('clear_tag', '1');
    44.  
    45.   // CATEGORY AND SECTION
    46.   $showsec  = $params->def('showsec', '1');
    47.   $showseclink  = $params->def('showseclink', '1');
    48.   $showcat  = $params->def('showcat', '1');
    49.   $showcatlink  = $params->def('showcatlink', '1');
    50.  
    51.   //READMORE
    52.   $read_more  = $params->get('read_more', '1');
    53.   $rmtext  = $params->def('rmtext', 'Read more...');
    54.  
    55.   //AUTHOR
    56.   $avtor = $params->def('avtor', '1');
    57.  
    58.   //DATA
    59.   $showDate  = $params->get('showDate', 1);
    60.   $data_format  = $params->get('data_format', '%d.%m.%Y');
    61.   $df_d  = $params->get('df_d', '%d');
    62.   $df_m  = $params->get('df_m', '%m');
    63.   $df_y  = $params->get('df_y', '%Y');
    64.  
    65.   //TIPS
    66.   $dgmtips  = $params->get('dgmtips', '1');
    67.  
    68.   //IMAGE
    69.   $imageWidth  = intval($params->get('imageWidth', '50'));
    70.   $imageHeight  = intval($params->get('imageHeight', ''));
    71.   $thumb_width  = intval($params->get('thumb_width', 1));
    72.   $thumb_filter  = intval($params->get('thumb_filter', 1));
    73.   $Zoom_Crop  = intval($params->get('Zoom_Crop', 0));
    74.   $thumb_filter_color = intval($params->get('thumb_filter_color', 1));
    75.   $pik  = $params->def('pik', '1');
    76.   $noimage  = $params->def('noimage', '1');
    77.   $imglink  = $params->def('imglink', '1');
    78.   $moreparam  = $params->def('moreparam', '');
    79.  
    80.   //HITS
    81.   $showHits  = $params->get('showHits', '1');
    82.  
    83.   //COMMENTS
    84.   $JC = $params->def('JC', '0');
    85.  
    86.      $contentConfig = &JComponentHelper::getParams( 'com_content' );
    87.      $access     = !$contentConfig->get('show_noauth');
    88.  
    89.   if ($selekt_secid_catid == 1){
    90.   $catid  = $catid_select;
    91.   $secid  = $secid_select;
    92.   } else{
    93.   $catid  = $catid_text;
    94.   $secid  = $secid_text;
    95.   }  
    96.  
    97.      $nullDate   = $db->getNullDate();
    98.  
    99.      $date =& JFactory::getDate();
    100.      $now = $date->toMySQL();
    101.  
    102.      $where     = 'a.state = 1'
    103.        . ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )'
    104.        . ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )'
    105.        ;
    106.  
    107.      // User Filter
    108.      switch ($params->get( 'user_id' )) {
    109.        case 'by_me':
    110.          $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')';
    111.          break;
    112.        case 'not_me':
    113.          $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')';
    114.          break;
    115.      }
    116.  
    117.      // Ordering
    118.      switch ($params->get( 'ordering' )) {
    119.   case 'title':
    120.   $orderBy = 'a.title ASC';
    121.   break;
    122.   case 'title_desc':
    123.   $orderBy = 'a.title DESC';
    124.   break;
    125.   case 'id':
    126.   $orderBy = 'a.id';
    127.   break;
    128.   case 'id_desc':
    129.   $orderBy = 'a.id DESC';
    130.   break;
    131.   case 'hits':
    132.   $orderBy = 'hits DESC';
    133.   break;
    134.   case 'created':
    135.   $orderBy = 'a.created';
    136.   break;
    137.   case 'modified_desc':
    138.   $orderBy = 'a.modified DESC';
    139.   break;
    140.   case 'ordering':
    141.   $orderBy = 'a.ordering ASC';
    142.   break;
    143.   case 'ordering_desc':
    144.   $orderBy = 'a.ordering DESC';
    145.   break;
    146.   case 'rand':
    147.   $orderBy = 'rand()';
    148.   break;
    149.   case 'created_desc':
    150.   default:
    151.   $orderBy = 'a.created DESC';
    152.   break;
    153.      }
    154.  
    155.      if ($catid) {
    156.        $ids = explode( ',', $catid );
    157.        JArrayHelper::toInteger( $ids );
    158.        $catCondition = ' AND (cc.id=' . implode( ' OR cc.id=', $ids ) . ')';
    159.   }
    160.  
    161.   if ($secid) {
    162.        $ids = explode( ',', $secid );
    163.        JArrayHelper::toInteger( $ids );
    164.        $secCondition = ' AND (s.id=' . implode( ' OR s.id=', $ids ) . ')';
    165.   }
    166.  
    167.   if ($show_frontpage == 1) {
    168.   $joinfront = "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id";
    169.   } else {
    170.   $joinfront = ($show_frontpage == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '');
    171.   }
    172.  
    173.      // Content Items only
    174.      $query = 'SELECT a.*, u.name, a.created_by_alias, cc.title AS cattitle, s.title AS sectitle, ' .
    175.        ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'.
    176.        ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug,'.
    177.        ' CASE WHEN CHAR_LENGTH(s.alias) THEN CONCAT_WS(":", s.id, s.alias) ELSE s.id END as sectionslug'.
    178.        ' FROM #__content AS a' .
    179.   $joinfront .
    180.   ' LEFT JOIN #__users AS u ON u.id = a.created_by'  .
    181.        ' INNER JOIN #__categories AS cc ON cc.id = a.catid' .
    182.        ' INNER JOIN #__sections AS s ON s.id = a.sectionid' .
    183.        ' WHERE '. $where .' AND s.id > 0' .
    184.        ($access ? ' AND a.access <= ' .(int) $aid. ' AND cc.access <= ' .(int) $aid. ' AND s.access <= ' .(int) $aid : '').
    185.        ($catid ? $catCondition : '').
    186.        ($secid ? $secCondition : '').
    187.   ($show_frontpage == '0' ? ' AND f.content_id IS NULL' : '').
    188.        ' AND s.published = 1' .
    189.        ' AND cc.published = 1' .
    190.        ' ORDER BY '. $orderBy;
    191.      $db->setQuery($query, 0, $count);
    192.      $rows = $db->loadObjectList();
    193.  
    194.      $i     = 0;
    195.      $lists   = array();
    196.  
    197.   foreach ( $rows as $row ) {
    198.        if($row->access <= $aid) {
    199.          $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
    200.   $catlink = JRoute::_(ContentHelperRoute::getCategoryRoute($row->catslug, $row->sectionid));
    201.   $seclink = JRoute::_(ContentHelperRoute::getSectionRoute($row->sectionid));
    202.          $lists[$i]->readmore = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
    203.   } else {
    204.      $lists[$i]->link = JRoute::_('index.php?option=com_user&view=login');
    205.   $catlink = JRoute::_('index.php?option=com_user&view=login');
    206.   $seclink = JRoute::_('index.php?option=com_user&view=login');
    207.      $lists[$i]->readmore = JRoute::_('index.php?option=com_user&view=login');
    208.   }
    209.  
    210.   //TITLE
    211.   /*article title*/
    212.   $lists[$i]->text = htmlspecialchars( $row->title );
    213.   /*section title*/
    214.   $sectitle = htmlspecialchars( $row->sectitle );
    215.   /*category title*/
    216.   $cattitle = htmlspecialchars( $row->cattitle );
    217.  
    218.   if($showsec == 1){
    219.   if($showseclink == 1){
    220.   $lists[$i]->sectitle = '<a href="'. $seclink .'" title="'. $sectitle .'">'.$sectitle .'</a>';
    221.   } else {
    222.   $lists[$i]->sectitle = $sectitle;
    223.   }
    224.   }
    225.  
    226.   if($showcat == 1){
    227.   if($showcatlink == 1){
    228.   $lists[$i]->cattitle = '<a href="'. $catlink .'" title="'. $cattitle .'">'.$cattitle .'</a>';
    229.   } else {
    230.   $lists[$i]->cattitle = $cattitle;
    231.   }
    232.   }
    233.  
    234.   //READMORE
    235.   $lists[$i]->rmtext = $rmtext;
    236.  
    237.   //TIPS
    238.   if ($dgmtips == 1) {
    239.   $dgm_title = ' title="'. $row->title .'" ';
    240.   }
    241.  
    242.   //IMAGE
    243.   if ($pik==1) {
    244.   $iW  = $imageWidth;
    245.   $iH  = $imageHeight;
    246.  
    247.   if ($imglink == 1) {
    248.   $imlink = '<a href="'. $lists[$i]->link .'"'. $dgm_title .'>';
    249.   $imlink2 = '</a>';
    250.   }
    251.  
    252.   $imgPrefix = JURI::base() .'modules/mod_junewsultra/img/img.php?src=../../../';
    253.   if ($thumb_width==1){
    254.   if ($Zoom_Crop==1){
    255.   $zc = '&amp;zc=1';
    256.   } else {
    257.   $zc = '&amp;zc=0';
    258.   }
    259.   if ($thumb_filter==1){
    260.   if ($thumb_filter_color==1){
    261.   $imgfiltr = '&amp;fltr[]=sep';
    262.   } else {
    263.   $imgfiltr = '&amp;fltr[]=gray';
    264.   }
    265.   $img_filtr = $imgfiltr;
    266.   }
    267.   //$imgthr = JURI::base() .'modules/mod_junewsultra/img/img.php?src=';
    268.   $imgthr = JURI::base() .'modules/mod_junewsultra/img/';
    269.   $imgthr2 = '&amp;w='. $iW .'&amp;h='. $iH .'&amp;q=100'. $zc . $img_filtr . $moreparam;
    270.   }
    271.  
    272.   $junuimgresmatche = $row->introtext . $row->fulltext;
    273.   preg_match('#src="(.*?)"#s',$junuimgresmatche,$junuimgsource);
    274.   $junuimgsource  = $junuimgsource[1];
    275.   $junuimgsource  = str_replace(JURI::base(), '', $junuimgsource);
    276.  
    277.   if ($thumb_width==1) {
    278.   $junuimg  = base64_encode(  '../../../' . $junuimgsource . $imgthr2 );
    279.   $jununoimg  = base64_encode(  '../../../media/mod_junewsultra/' . $noimage . $imgthr2 );
    280.  
    281.   if( $junuimgsource  ){
    282.   $lists[$i]->image = $imlink .'<img src="'. $imgthr . $junuimg .'_junus.jpg" alt="'. $row->title .'" />'. $imlink2;
    283.   } else {
    284.   $lists[$i]->image = $imlink .'<img src="'. $imgthr . $jununoimg .'_junus.jpg" alt="'. $row->title .'" />'. $imlink2;
    285.   }
    286.   } else {
    287.   $junuimg  = $junuimgsource;
    288.   $jununoimg  = JURI::base().'/media/mod_junewsultra/' . $noimage;
    289.  
    290.   if( $junuimgsource  ){
    291.   $lists[$i]->image = $imlink .'<img src="'. $imgthr . $junuimg .'" alt="'. $row->title .'" />'. $imlink2;
    292.   } else {
    293.   $lists[$i]->image = $imlink .'<img src="'. $imgthr . $jununoimg .'" alt="'. $row->title .'" />'. $imlink2;
    294.   }
    295.   }
    296.   }
    297.  
    298.   //INTROTEX
    299.   if ($clear_tag == 1){
    300.   $row->introtext = preg_replace('/{([a-zA-Z0-9\-_]*)\s*(.*?)}/i', '', $row->introtext);
    301.   $row->introtext = str_replace( '&nbsp;', ' ', $row->introtext );
    302.   $row->introtext = strip_tags( $row->introtext );
    303.   } else {
    304.   $row->introtext = preg_replace('/{([a-zA-Z0-9\-_]*)\s*(.*?)}/i', '', $row->introtext);
    305.   $row->introtext = preg_replace('/<img(.*?)>/i', '', $row->introtext);
    306.   }
    307.  
    308.   if ($li==1){
    309.   if ($lmttext==1){
    310.   $lists[$i]->introtext =  implode(" ", array_slice(explode(" ", $row->introtext), 0, $introtext_limit));
    311.   } else {
    312.   $lists[$i]->introtext = substr($row->introtext, 0, $introtext_limit);
    313.   }
    314.  
    315.   if (!preg_match('#(\.|\?|\!)$#ismu', $lists[$i]->introtext)) {
    316.   $lists[$i]->introtext = preg_replace('#\s?(\,|\;|\:|\-)#ismu', '', $lists[$i]->introtext);
    317.   $lists[$i]->introtext = $lists[$i]->introtext . '...';
    318.   }
    319.   } else {
    320.   $lists[$i]->introtext = $row->introtext;
    321.   }
    322.  
    323.   //AUTHOR
    324.   if ($avtor==1) {
    325.   if ( $row->created_by_alias ) {
    326.           $lists[$i]->author = $row->created_by_alias;
    327.         } else {
    328.           $lists[$i]->author = $row->name;
    329.         }
    330.   }
    331.  
    332.   //DATA
    333.   if ($showDate){
    334.   $lists[$i]->created  = JHTML::_('date', $row->created, $data_format );
    335.   $lists[$i]->df_d  = JHTML::_('date', $row->created, $df_d );
    336.   $lists[$i]->df_m  = JHTML::_('date', $row->created, $df_m );
    337.   $lists[$i]->df_y  = JHTML::_('date', $row->created, $df_y );
    338.   }
    339.   //SHOW HITS
    340.   if ($showHits){
    341.   $lists[$i]->hits  = $row->hits;
    342.   }
    343.  
    344.   //JComments
    345.   if ($JC) {
    346.   $comments = JPATH_SITE . '/components/com_jcomments/jcomments.php';
    347.      if (file_exists($comments)) {
    348.        require_once($comments);
    349.        $count = JComments::getCommentsCount($row->id, 'com_content');
    350.   $lists[$i]->comments = $count ? ('<a class="comment-link" href="'. $lists[$i]->link .'#comments">'. JText::_('JCOMMENTS_COUNT') .' ('. $count . ')</a>') : '<a class="comment-link" href="'. $lists[$i]->link .'#addcomments">'. JText::_('JCOMMENTS_WRITE') .'</a>';
    351.      }
    352.   } else {
    353.   $lists[$i]->comments  = '';
    354.   }
    355.  
    356.        $i++;
    357.  
    358.      }
    359.  
    360.      return $lists;
    361.  
    362.    }
    363.  
    364. }
    365.  
    366. ?>
     
  2.  
  3. shure348
    Offline

    shure348 Активист

    Регистрация:
    21.08.2012
    Сообщения:
    145
    Симпатии:
    27
    Пол:
    Мужской
    дык вот же
    Код (html):
    1. <span><?php echo $item->text; ?></span>
     
  4. Offline

    Balanar Пользователь

    Регистрация:
    22.01.2015
    Сообщения:
    57
    Симпатии:
    0
    Пол:
    Мужской
    Мне вот в этой ссылки нужно убрать категорию. А где она формируется я не знаю.

    Код (PHP):
    1. <?php echo $item->link; ?>
     
  5. woojin
    Offline

    woojin Местный Команда форума => Cпециалист <=

    Регистрация:
    31.05.2009
    Сообщения:
    3 206
    Симпатии:
    334
    Пол:
    Мужской
    @Balanar
    ты хотя бы пути до файлов укажи и версию J что бы можно было самому посмотреть. а не ползать тут по коду!

    на вскидку: ищи объект $item и смотри где в него внедряется переменная $link
     

Поделиться этой страницей

Загрузка...