The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
PostPosted: Wed Mar 03, 2010 10:02 am 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
Am developing custom component for joomla.
I need sef urls for my custom component.
Joomla has a lack of sef urls.

There are two main components on the market:
- Artio sef
- Sh404sef

I installed artio
The problem is that it stores all sef urls in the db, and it’s alike +100queries for the main page of the component. I have a lot of duplicates like custom-1 custom-2 custom-3
Is that the principle of it’s work, to store everything in db and then just to replace? Or it’s because I haven’t written custom extention for my component?

I installed sh404sef and looks like it isn’t using db for storing sef urls. But it looks like complicated to rebuild urls in another way.

Alternative solution is manually to write rewrite rules for custom component in htaccess.

Any advice?


Top
 Profile  
 
PostPosted: Wed Mar 03, 2010 1:39 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 7962
Location: The Netherlands
I am using the normal SEF of Joomla! for my components.
Do you want to distribute the component or is it for your own use only?
If so, you can write a plugin to work with the desired SEF component as Artio. If you want to distribute, I think you should use normal Joomla! SEF, otherwise you're pushing another one to use that extention also.

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
 Profile  
 
PostPosted: Wed Mar 03, 2010 1:47 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
dam-man wrote:
I am using the normal SEF of Joomla! for my components.
Do you want to distribute the component or is it for your own use only?
If so, you can write a plugin to work with the desired SEF component as Artio. If you want to distribute, I think you should use normal Joomla! SEF, otherwise you're pushing another one to use that extention also.


is it possible to rebuild
index.php?option=myComponent&task=viewUserDetails &userId=2456&Itemid=23

into fully SEF:
This-is-my-User-name/View-user-details.html

or partially SEF URL:
View-user-details.html?userId=2456

using joomla sef router?

Unfortunately I haven't found much documentation about how to create sef url using core joompla functions and tried to use extentions. But I wish too.

Where can I find examples of sef routers for custom components? may be you know any extention which can be revieiwed as an example?


Top
 Profile  
 
PostPosted: Wed Mar 03, 2010 1:58 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 7962
Location: The Netherlands
devlabs wrote:
is it possible to rebuild
index.php?option=myComponent&task=viewUserDetails &userId=2456&Itemid=23

into fully SEF:
This-is-my-User-name/View-user-details.html

or partially SEF URL:
View-user-details.html?userId=2456



Look at my component here, you don't an ID or URL like you have mentioned above:

The way you think Joomla is doing it:
Code:
http://yourdomain.com/View-user-details.html?userId=2456 

Below my written router creating URLs like below:
Code:
http://pro.rd-media.org/rd-autos-pro-20/rd-autos-support/detail/56-change-currency.html

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
 Profile  
 
PostPosted: Wed Mar 03, 2010 7:36 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
dam-man wrote:
Look at my component here, you don't an ID or URL like you have mentioned above:

The way you think Joomla is doing it:
Code:
http://yourdomain.com/View-user-details.html?userId=2456 

Below my written router creating URLs like below:
Code:
http://pro.rd-media.org/rd-autos-pro-20/rd-autos-support/detail/56-change-currency.html



do I need to buy a pro version to view the code of fully functional router?

because in free version I have
/index.php/component/rdautos/?view=category&id=1
/index.php/component/rdautos/?view=detail&id=8

may be I have setuped something wrong. I disabled all sef components except core ones.


Top
 Profile  
 
PostPosted: Wed Mar 03, 2010 8:49 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Sep 09, 2005 2:13 pm
Posts: 7962
Location: The Netherlands
That's because the free version has no SEF at the moment. New version is coming with SEF. I have to restructure all links to have proper SEF url.

This will be the new Router:
Code:
<?php
function RDAutosBuildRoute(&$query)
{
       $segments = array();
       if(isset($query['view']))
       {
                $segments[] = $query['view'];
                unset( $query['view'] );
       }
       if(isset($query['id']))
       {
                $segments[] = $query['id'];
                unset( $query['id'] );
       };
       if(isset($query['layout']))
       {
                $segments[] = $query['layout'];
                unset( $query['layout'] );
       };      
      
       return $segments;
}


function RDAutosParseRoute($segments)
{
       $vars = array();
       switch($segments[0])
       {
               case 'categories':
                       $vars['view'] = 'categories';
                       $id = explode( ':', $segments[1] );
                       $vars['id'] = (int) $id[0];                  
                       break;
               case 'category':
                       $vars['view'] = 'category';
                       $id = explode( ':', $segments[1] );
                       $vars['id'] = (int) $id[0];
                       break;
               case 'detail':
                       $vars['view'] = 'detail';
                       $id = explode( ':', $segments[1] );
                       $vars['id'] = (int) $id[0];
                       break;   
               case 'search':
                       $vars['view'] = 'search';
                       $vars['layout'] = (int) $segments[2];
                       break;                        
               case 'sendafriend':
                       $vars['view'] = 'sendafriend';
                       $id = explode( ':', $segments[1] );
                       $vars['id'] = (int) $id[0];
                       break;                                                           
       }
       return $vars;
}


But it won't work on the current free version, because not all links are ready for it. Try to have this new version within 2 weeks done.

_________________
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 3:34 am 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
Code:
      if(isset($query['option']))
       {
                $segments[] = $query['option']; // with or without this line
                unset( $query['option'] );
       }



I use next links
echo JRoute::_( 'index.php?option=com_name&controller=new&task=build');

What can be the reason that I have
"option=com_name" replaced by "component/com_name"

insted of
/com_name/ or /name/

in sef URL ?


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 1:28 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
may be I don't need to use option=com_name in the link but then sef doesn't work at all?


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 2:19 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 03, 2006 1:45 pm
Posts: 151
Location: Netherlands
Small advice: use the Joomla router functionality. This is also still present within Joomla 1.6.

sh404sef is good but is not using the router functionality and sh404sef is not ready for Joomla 1.6. Artio is a very slow sef rewriter specially if you are using a lot of internal URL's.

Good news is that I'm working on a new SEF rewriter component for Joomla 1.5 and Joomla 1.6 which whereby the component automatically detects and include local component router files for the URL rewriting whereby you have the ability to remove numbers used in the URL which identifies the ID.

We will release it under the GPL license and the performance is better then the default Joomla SEF router and 50% faster then sh404sef and 200% faster then Artio.

Release will be within 2 months, also available for Joomla 1.6(!)

Note: its is storing the URL's in the database but its using an advanced caching system whereby the retrieving the URLs from the DB requires only 1 query and is actual faster then the default Joomla router once the pages are within the database.

Spiderglobe 2010.


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 3:35 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
Yea I am using joomla core SEF which is a good thing ;)

I got an advice that if the
echo JRoute::_( $url );
doesn't have an itemID then it will add "component/com_name" to the beginning of sef URL

The component isn't using itemID at all and don't need it.(site menu and modules are disabled and done inside of the component)
How can I apply a fix for required itemID so that it wasn't required at all?


2 spiderglobe
thanks but what will you do with such pages a list of USERS?
Artio SEF has 100 sql queries on such page with enabled cache and 400 without it. The same thing with sh404.

It will be good if your component could work without sql queries even if you store all the data compresed in one variable.


Top
 Profile  
 
PostPosted: Thu Mar 25, 2010 5:24 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Apr 03, 2006 1:45 pm
Posts: 151
Location: Netherlands
It works also with a cache storage within the database. But it uses once the pages are loaded only 1 query to fetch the cached URL's which is very fast.

I've made serveral bench marks with jmeter and compare it to artio / sh404sef and the basic joomla sef router. In all the cased (different pages) the component is faster also faster then the core Joomla sef router since the Joomla core sef router must rewrite all urls by loading the components router files and parse these as well the component we are building is doing that from the cache.... Special on pages with a lot of URL's.....


Top
 Profile  
 
PostPosted: Fri Mar 26, 2010 5:37 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Jan 23, 2009 10:39 pm
Posts: 54
I got an advice that if the
echo JRoute::_( $url );
doesn't have an itemID then it will add "component/com_name" to the beginning of sef URL

The component isn't using itemID at all and don't need it.(site menu and modules are disabled and done inside of the component)
How can I apply a fix for required itemID so that it wasn't required at all?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 



Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group