Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

how to develop an extension
(1 viewing) (1) Guest
Support forum for users using free edition of JoomSEF 3 (Joomla 1.5 compatible). These forums are mainly for mutual help between users.

Please note that due to our capacity limitations, we do not monitor these forums regularly.
  • Page:
  • 1
  • 2

TOPIC: how to develop an extension

how to develop an extension 18 years, 2 months ago #75

  • divivo
Hi,

I would like to develop an extension for Acajoom component. Where do I get started. Is there a documentation or example on how to develop a third party extension for JoomSEF.
Thanks in advance
chris

Re:how to develop an extension 18 years, 2 months ago #77

  • jaku
Hello Chris,

we are sorry, but so far there is no documention for developing 3rd party extensions ready. We still plan to do some major changes in the object model, so maybe we write some after that.

As regards example, you can use some of the models in /sef_ext directory. E.g. DocMan or Joomlaboard.

Basically, what you need to create a new extension is:
  1. create a new file named same as the module you are writing the ext for
  2. build the desired SEF path using the values from the module (so probably you read some data from module tables here etc.) and variables from the original URL that you can get by extract($vars); command, such as IDs and similar; the final path should be prepared in an array, e.g. named fields (each member is one level in SEF URL)
  3. when your path is prepared, just call: $string = sef_404::sefGetLocation($string, $title, $task, (isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null), (isset($lang) ? @$lang : null));, where $title is your prepared path array, string is the original URL (is handed automatically, just leave it as it is); if desired, $task may be set to null; if$taskt is empty, then path is composed just from $title, otherwise task is appended to it


Well and that is it. It is no big deal, really.

If you write a new ext yourself, please send it to us, so we can add it to the installation package.

Regards,
Honza<br><br>Post edited by: jan, at: 2006/09/05 02:02

Re:how to develop an extension 18 years, 2 months ago #79

  • divivo
Honza,

that's great very useful. the file will be install in the SEf component extension folder. There is nothing to install in my component, is that correct?
Thank you for your complete answer
Chris

Re:how to develop an extension 18 years, 2 months ago #84

  • jaku
Hi Chris,

wel in fact there are 2 possibilities where to put your SEF extension.

    [li]First, the SEF engine will search in the root directory of the component for file named sef_ext.php[\li]
  1. If such file is not found, then /sef_ext dir in the JoomSEF component is searched for file named com_(module name).php
  2. If neither of those files is found, then a standard SEF handler will be used, unless the SEF is disabled for the module in question


Have a nice day,
Honza

Re:how to develop an extension 18 years, 2 months ago #354

  • metin
Hello All,
i tried to make new sef file for Sobi Yellow Pages, but it does not work, could you check codes please?
i also based on example sef file.

the file named as com_sobi.php and uploaded com_sef/sef_ext

non sef category url:
index.php?option=com_sobi&amp;catid=89&amp;Itemid=34

non sef items url
index.php?option=com_sobi&amp;task=details&amp;catid=62&amp;id=161&amp;Itemid=34

row name for categories on database : categoryname
row name for items on database: name

 
&lt;?php
[size=4]/**
* SEF module for Joomla!
* Originally written for Mambo as 404SEF by W. H. Welch.
*
* This is an example file demonstrating how to write own extensions for Artio JoomSEF.
*
* @author $Author: michal $
* @copyright ARTIO s.r.o., http://www.artio.cz
* @package JoomSEF
* @version $Name$, ($Revision: 4994 $, $Date: 2005-11-03 20:50:05 +0100 (??t, 03 XI 2005) $)
*/

 
// Security check to ensure this file is being included by a parent file.
if (!defined('_VALID_MOS')) die('Direct Access to this location is not allowed.');
 
/**
* Note 1: This file shoud be named as com_YOUR-COMPONENT-NAME.php in order to work correctly.
*/

 
/**
* Use this to get variables from the original Joomla! URL, such as $task, $page, $id, $catID, ...
*/

extract($vars);
 
/**
* Now compose your SEF path.
* Store the path parts in an array. Further named $fields in this example.
*
* To compose the path, you will probably need to call your module funcitons (methods) or connect
* to the tables used by your module.
*/

 
// This example loads category title from Joomlaboard forum (in case $catid is defined after export call).
if (isset($catid)) {
$query = &quot;
SELECT `categoryname`
FROM `#__$message_cat_table_suffix`
WHERE `id` = $catid
&quot;;
$database-&gt;setQuery($query);
$catTitle = $database-&gt;loadResult();
}
 
// Now category title loaded from DB is added as the first part of the future SEF path.
if (!empty($categoryname)) {
$title[] = $categoryname;
// Unset the original URL variable not to interfere anymore.
unset($vars['catid']);
}
 
// This example loads message title from Joomlaboard forum (in case $id is defined after export call).
if (isset($id)) {
$query = &quot;
SELECT `name`
FROM `#__$message_table_suffix`
WHERE `id` = $id
&quot;;
$database-&gt;setQuery($query);
$msgTitle = $database-&gt;loadResult();
}
 
// Now message title read from DB is added as the next part of the SEF path.
if (!empty($name)) {
$title[] = $name;
// Unset the original URL variable not to interfere anymore.
unset($vars['id']);
}
 
// ... further parts may be added here ... //
 
/**
* Finally, at the end of this file, call JoomSEF::«»sefGetLocation method to generate and store resulting URL.
*
* $string - original URL which comes automatically (do not change this)
* $title - your SEF path (array of single parts)
* $task - if not empty (null), the task string will be appended to resulting SEF URL,
* e.g. if task=read, the result URL will be your/parts/read(suffix)
*/

if (count($title) &gt; 0) {
$string = JoomSEF::«»sefGetLocation($string, $title, $task, (isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null), (isset($lang) ? @$lang : null));
}
 
/**
* And that is all folks!
*/

?&gt;[/size]
 
<br><br>Post edited by: metin, at: 2006/09/28 16:15

Re:how to develop an extension 17 years, 6 months ago #2278

Hello Jan,

I succesfully developed a custom extension for the component RapidRecipe!

In the Example is an error, it should be:
$string = sef_404::sefGetLocation(...)

instead of:
$string = JoomSEF::sefGetLocation(...)

btw: Will it increase the Speed when I uninstall the included extensions like &quot;alphaconten&quot;, &quot;docman&quot; etc? I don't need all of them.

Regards, Nino
http://www.tortenformel.de Home of your Lieblingsrezept! German Recipe Database for Tortes, Flans, Cakes, Gateaux - with self-made ARTIO Extension
  • Page:
  • 1
  • 2
User Login Empty