sitemap  |  contact

Sakic.Net Forum
06 October 2008, 16:37 *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
News: Save money on product bundles: http://www.sakic.net/support/order/
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: sef_ext.php for components  (Read 1258 times)
MikeGH
Newbie
*
Posts: 3


View Profile
« on: 08 May 2008, 00:01 »

If you have a joomla 1.5 component that comes with a functioning router.php and want to use it with SEF advanced, you can create a sef_ext.php with the following content:

[replace XXXXXX with the name of the component (after com_)]
<?php
/**
* SEF Advance component extension
*
* This extension will give the SEF Advance style URLs to the example component
* Place this file (sef_ext.php) in the main component directory
* Note that the class must be named: sef_componentname
*
* Copyright (C) 2003-2007 Emir Sakic, http://www.sakic.net, All rights reserved.
*
* Comments: for SEF Advance > v3.6
**/
require_once("router.php");

class sef_XXXXXX {
   
   /**
   * Creates the SEF Advance URL out of the request
   * Input: $string, string, The request URL (index.php?option=com_example&Itemid=$Itemid)
   * Output: $sefstring, string, SEF Advance URL ($var1/$var2/)
   **/
   function create ($string)
   {
      $string = str_replace("&amp;","&",$string);
      $o = split("&",substr($string,strpos($string,"index.php?")+10));   
      foreach($o as $value)
      {
         $i = split("=",$value);
         $ns[$i[0]] = $i[1];   
      }
      $result = XXXXXXBuildRoute($ns);
      foreach($result as $val)
      {
         $retval .= $val;
         $retval .= "/";   
      }
      return $retval;
   }
   
   /**
   * Reverts to the query string out of the SEF Advance URL
   * Input:
   *    $url_array, array, The SEF Advance URL split in arrays
   *    $pos, int, The position offset for virtual directories (first virtual directory, which is the component name, begins at $pos+1)
   * Output: $QUERY_STRING, string, query string (var1=$var1&var2=$var2)
   *    Note that this will be added to already defined first part (option=com_example&Itemid=$Itemid)
   **/
   function revert ($url_array, $pos)
   {
   
      $na = array();
      for ($a=$pos+2;$a<count($url_array);$a++)
      {
         if (strlen($url_array[$a]) > 0)
         {
            $na[] = $url_array[$a];
         }
      }
      $res = XXXXXXParseRoute($na);
      $QUERY_STRING = '';
      foreach($res as $key=>$value)
      {
         $QUERY_STRING .="&";
         $QUERY_STRING .=$key;
         $QUERY_STRING .="=";
         $QUERY_STRING .=$value;   
         $GLOBALS[$key] = $_GET[$key] = $_REQUEST[$key] = $value;                  
      }
      return $QUERY_STRING;
   }   
}
?>
Logged
Saka
Administrator
Hero Member
*****
Posts: 1,231


View Profile WWW
« Reply #1 on: 19 May 2008, 14:58 »

Thanks. The latest version of SEF Advance 2008 will also use router.php file automatically if sef_ext.php is not present.
Logged

totalsuper
Newbie
*
Posts: 1


View Profile
« Reply #2 on: 23 June 2008, 13:56 »

Has anyone made one of these for Schlu.net's EventList for Joomla 1.5? Could you post it as an attachment or let Saka post it to the third-party extension support page, please? Thank you.
Logged
gringog
Newbie
*
Posts: 1


View Profile
« Reply #3 on: 25 June 2008, 18:47 »

fantastic but im pretty stuck here

I am trying to install Profile Url for Joomlapolis which inturn tells me I need

Make sure you have configured sh404SEF/Artio JoomSEF first!

which I tried but wont let me install unless I have the sef_ext.php working

I am stuck on

If you have a joomla 1.5 component that comes with a functioning router.php and want to use it with SEF advanced, you can create a sef_ext.php with the following content:

[replace XXXXXX with the name of the component (after com_)]
<?php
/**
* SEF Advance component extension
*
* This extension will give the SEF Advance style URLs to the example component
* Place this file (sef_ext.php) in the main component directory
* Note that the class must be named: sef_componentname

can any one help me customize this?
Logged
Pages: [1]
  Print  
 
Jump to: