Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. CMS & Piattaforme Self-Hosted
  5. [2.5] Modificare parte della url

[2.5] Modificare parte della url

Pianificato Fissato Bloccato Spostato CMS & Piattaforme Self-Hosted
1 Post 1 Autori 807 Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • B
    B
    bill152
    scritto su ultima modifica di
    User Attivo 0
    #1
    [2.5] Modificare parte della url

    Ciao a tutti volevo sapere se qualcuno sa come modificare il seguente codice (components/com_sh404sef/sef_ext/com_content.php in joomla 2.5) perchè l'id dell'articolo venga mostrato alla fine dell'url e non all'inizio in questo modo.

    L'url attualmente è mostrata così:
    http://www.mysite.com/section/category/1277-article_title.htmlhttp://www.mysite.com/section/category/

    Vorrei modificarla così:
    http://www.mysite.com/section/category/article_title-1277.html

    Ecco il codice:

    <?php/** * sh404SEF - SEO extension for Joomla! * * @author      Yannick Gaultier * @copyright   (c) Yannick Gaultier 2012 * @package     sh404sef * @license     http://www.gnu.org/copyleft/gpl.html GNU/GPL * @version     3.7.0.1485 * @date		2012-11-26 */
    defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );
    // ------------------  standard plugin initialize function - don't change ---------------------------global $sh_LANG;$sefConfig = & Sh404sefFactory::getConfig();$shLangName = '';$shLangIso = '';$title = array();$shItemidString = '';$dosef = shInitializePlugin( $lang, $shLangName, $shLangIso, $option);if ($dosef == false) return;// ------------------  standard plugin initialize function - don't change ---------------------------
    // ------------------  load language file - adjust as needed ----------------------------------------$shLangIso = shLoadPluginLanguage( 'com_content', $shLangIso, 'COM_SH404SEF_CREATE_NEW');// ------------------  load language file - adjust as needed ----------------------------------------
    // get DB$database =ShlDbHelper::getDb();
    // 1.2.4.q this is content item, so let's try to improve missing Itemid handling// retrieve section id to know whether this static or not$shHomePageFlag = false;
    $shHomePageFlag = !$shHomePageFlag ? shIsHomepage ($string): $shHomePageFlag;
    if (!$shHomePageFlag) {  // we may have found that this is homepage, so we msut return an empty string  // do something about that Itemid thing  if (!preg_match( '/Itemid=[0-9]+/iu', $string)) { // if no Itemid in non-sef URL    // V 1.2.4.t moved back here    if ($sefConfig->shInsertGlobalItemidIfNone && !empty($shCurrentItemid)) {      $string .= '&Itemid='.$shCurrentItemid; ;  // append current Itemid      $Itemid = $shCurrentItemid;      shAddToGETVarsList('Itemid', $Itemid); // V 1.2.4.m    }
        if ($sefConfig->shInsertTitleIfNoItemid)    $title[] = $sefConfig->shDefaultMenuItemName ?  		$sefConfig->shDefaultMenuItemName : getMenuTitle($option, (isset($view) ? $view : null), $shCurrentItemid, null, $shLangName );  // V 1.2.4.q added forced language  		$shItemidString = '';  		if ($sefConfig->shAlwaysInsertItemid && (!empty($Itemid) || !empty($shCurrentItemid)))    $shItemidString = JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX').$sefConfig->replacement    .(empty($Itemid)? $shCurrentItemid :$Itemid);  } else {  // if Itemid in non-sef URL    $shItemidString = $sefConfig->shAlwaysInsertItemid ?    JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX').$sefConfig->replacement.$Itemid    : '';    if ($sefConfig->shAlwaysInsertMenuTitle){      //global $Itemid; V 1.2.4.g we want the string option, not current page !      if ($sefConfig->shDefaultMenuItemName)      $title[] = $sefConfig->shDefaultMenuItemName;// V 1.2.4.q added force language      elseif ($menuTitle = getMenuTitle($option, (isset($view) ? $view : null), $Itemid, '',$shLangName )) {        if ($menuTitle != '/') $title[] = $menuTitle;      }    }  }  // V 1.2.4.m  shRemoveFromGETVarsList('option');  shRemoveFromGETVarsList('lang');  if (!empty($Itemid))  shRemoveFromGETVarsList('Itemid');  if (!empty($limit))  shRemoveFromGETVarsList('limit');  if (isset($limitstart))  shRemoveFromGETVarsList('limitstart');
      $view = isset($view) ? $view : null;  $layout = isset($layout) ? $layout : null;  $task = isset($task) ? $task : null;  switch ($view) {    case 'archivecategory':    case 'archivesection' :    case 'archive' :      $dosef = false;      break;    case 'form':      if ($layout == 'edit' && empty($a_id)) { // submit new article        $title[] = $sh_LANG[$shLangIso]['COM_SH404SEF_CREATE_NEW'];      } else {        $dosef = false;      }      break;    default:      if (sh404SEF_PDF_DIR && $view == 'article' && !empty($format) && $format == 'pdf') {        $title[] = sh404SEF_PDF_DIR;		// insert pdf directory        shMustCreatePageId( 'set', true);      }
          // V 1.2.4.j 2007/04/11 : numerical ID, on some categories only      if ($sefConfig->shInsertNumericalId && isset($sefConfig->shInsertNumericalIdCatList)      && !empty($id) && ($view == 'article')) {
            try {          $contentElement = ShlDbHelper::selectObject( '#__content', array( 'id', 'catid', 'created'), array( 'id' => $id));        } catch( Exception $e) {          ShlSystem_Log::error( 'sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());        }
            if ($contentElement) {          $foundCat = array_search($contentElement->catid, $sefConfig->shInsertNumericalIdCatList);          if (($foundCat !== null && $foundCat !== false)          || ($sefConfig->shInsertNumericalIdCatList[0] == ''))  { // test both in case PHP < 4.2.0            $shTemp = explode(' ', $contentElement->created);            $title[] = str_replace('-','', $shTemp[0]).$contentElement->id;          }        }      }
          // use libray function to fetch Joomla content title      if ($task == 'article.edit') {        if (empty($a_id)) { // submit new article          $title[] = $sh_LANG[$shLangIso]['COM_SH404SEF_CREATE_NEW'];        } else {          $dosef = false;        }      } else if (empty($layout) || (!empty($layout) && $layout != 'edit')) {
            $contentTitle = sef_404::getContentSlugsArray((isset($view) ? $view : null),(isset($id) ? $id : null),        (isset($layout) ? $layout : null), (isset($Itemid) ? $Itemid : null), $shLangName);        if (!empty($title)) {          $title = array_merge($title, $contentTitle); // V 1.2.4.q added forced language        } else {          $title = $contentTitle; // V 1.2.4.q added forced language        }        if (!empty($format) && $format == 'feed'){          $title[] = $format;          if (!empty($type) && $format != $type)          $title[] = $type;        }        if (!empty($print)) {          $title[] = JText::_( 'Print' );        } else {          shMustCreatePageId( 'set', true);        }      } else {        $dosef = false;      }
      }  // V 1.2.4.q  shRemoveFromGETVarsList('view');  if (isset($id))  shRemoveFromGETVarsList('id');  if (isset($layout))  shRemoveFromGETVarsList('layout');  // only remove format variable if forma tis html. In all other situations, leave it there as some  // system plugins may cause pdf and rss to break if they call JFactory::getDocument() in the onAfterInitialize event handler  // because at this time SEF url are not decoded yet.  if (isset($format) && (!sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR || (sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR && $format == 'html')))  shRemoveFromGETVarsList('format');  if (isset($type))  shRemoveFromGETVarsList('type');  if (!empty($catid))  shRemoveFromGETVarsList('catid');   // V 1.2.4.m  if (isset($showall))  shRemoveFromGETVarsList('showall');  if (empty($page))  // remove page if not set or 0  shRemoveFromGETVarsList('page');  if (isset($print))  shRemoveFromGETVarsList('print');  if (isset($tmpl) && $tmpl == 'component')   // remove if 'component', show otherwise as querystring  shRemoveFromGETVarsList('tmpl');
      // ------------------  standard plugin finalize function - don't change ---------------------------  if ($dosef){    $string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString,    (isset($limit) ? $limit : null), (isset($limitstart) ? $limitstart : null),    (isset($shLangName) ? $shLangName : null), (isset($showall) ? $showall : null));  }  // ------------------  standard plugin finalize function - don't change ---------------------------} else { // this is multipage homepage  $title[] = '/';  $string = sef_404::sefGetLocation( $string, $title, null, (isset($limit) ? $limit : null),  (isset($limitstart) ? $limitstart : null), (isset($shLangName) ? $shLangName : null),  (isset($showall) ? $showall : null));
    }
    
    1 Risposta Ultima Risposta
    Miglior risposta 0
    0

    Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

    Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

    Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

    Registrati Accedi
    Rispondi
    • Risposta alla discussione
    Effettua l'accesso per rispondere
    • Da Vecchi a Nuovi
    • Da Nuovi a Vecchi
    • Più Voti


    • Accedi

    • Non hai un account? Registrati

    • Accedi o registrati per effettuare la ricerca.
    • Primo post
      Ultimo post
    Home Accedi Registrati
    Menu
    • CATEGORIES
    • La Community Connect.gt
    • Presentati alla Community
    • News Ufficiali da Connect.gt
    • Internet News
    • A Scuola Di
    • Digital Marketing
    • Intelligenza Artificiale
    • SEO & GEO
    • Web Marketing e Content
    • Google Analytics e Web Analytics
    • Google Ads & Advertising
    • YouTube
    • TikTok, Instagram e altri Social
    • Google Adsense, Affiliazioni e Guadagno
    • E-Commerce
    • Coding e Sistemistica
    • Help Center: consigli per il tuo progetto
    • Hosting e Cloud
    • Coding
    • CMS & Piattaforme Self-Hosted
    • Annunci e Collaborazioni
    • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
    • Collaborazioni WEB e Lavoro: offro e cerco
    • Impresa, Fisco e Leggi
    • Consulenza Legale e Professioni Web
    • Consulenza Fiscale, Imprese, Startup e P.Iva
    • Gli Off Topic
    • PC, Smartphone e altri Hardware
    • Tutti i Software
    • GT Fetish Cafè
    • Discussioni
    • Non letti 0
    • Recenti
    • Hashtag
    • Popolare
    • Utenti
    • Privacy
    • Termini e condizioni
    • © 2026 Search On Media Group S.r.l.