sef_ext.php for components

16 years 4 months ago #2690 by MikeGH
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, 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("&","&",$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;
}
}
?>

Please Log in or Create an account to join the conversation.

16 years 4 months ago #2711 by Saka
Thanks. The latest version of SEF Advance 2008 will also use router.php file automatically if sef_ext.php is not present.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

16 years 2 months ago #2837 by totalsuper
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.

Please Log in or Create an account to join the conversation.

16 years 2 months ago #2855 by gringog
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?

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch