pepperstreet VIP
Total posts: 3,837
06 Июнь 2014 11:53

Just noticed the full view item URLs. There is only record ID. Is it a custom router for forum section?

../support/community-forum/item/2407.html

This reminds me on the documentation "Optimize SEF links" and comments area... There is also another article "Build your own SEF", which explains the Cobalt URLs. It is a good reference, but no tutorial! Frankly, that doesn't help me that much ;)

It would be really nice to have more tips on:

  • How to remove IDs from URL (!)
  • How you achieved the forum item URL
  • How to remove the /item/
  • How to remove the /category-items/
  • etc.

A step by step example to get the whole picture. Or even a pre-made alternative router: no-IDs-router.php, WP-style-router.php ;)

I think, many other users want the "simple and clean" SEF URLs like it is possible in Wordpress and Drupal.

Thanks for listening.

Последние изменения: 16 Окт 2015


Sergey
Total posts: 13,748
08 Июнь 2014 23:28

I cannot provide those tips. If I know how to remove all that from URL I would simply removed it. You have only 2 choises. Either your URL structure is stored in DB or DB have to be stored in the URL itself. So all these IDs, item or item-category is a DB that allow to decode URL without making queries and slow down.


pepperstreet VIP
Total posts: 3,837
09 Июнь 2014 02:00

Sergey I cannot provide those tips. If I know how to remove all that from URL I would simply removed it.

I thought, there is always none-SEF URL and a SEF URL. Internally and before display you are working with the none-SEF version... building links, routing etc.

Isn't SEF applied AFTER everything else has been done?!

So, i thought the whole SEF stuff and "my pretty URL" can be achieved in your custom router at the end. Without disturbing the inner workings of Cobalt.

Sergey item or item-category is a DB that allow to decode URL without making queries and slow down.

But those 2 are "constants", which can also be translated in language file. Why are they used anyway?> Sergey


Sergey
Total posts: 13,748
10 Июнь 2014 09:37

pepperstreet But those 2 are "constants", which can also be translated in language file. Why are they used anyway?

Ьусфыу those are flags. Those say what is this URL and how to decode it. Where is the section ID and there is the other IDs. If no this I have to save this data in DB.


pepperstreet VIP
Total posts: 3,837
10 Июнь 2014 10:46

Sergey

pepperstreet But those 2 are "constants", which can also be translated in language file. Why are they used anyway?

Ьусфыу those are flags. Those say what is this URL and how to decode it. Where is the section ID and there is the other IDs. If no this I have to save this data in DB.

They are not removable by Cobalt config or custom router ?!? :o


Sergey
Total posts: 13,748
10 Июнь 2014 23:57

If I remove them, I have to save full URL in DB. This is the way when extension become noticeably slower.


pepperstreet VIP
Total posts: 3,837
11 Июнь 2014 00:27

Sergey If I remove them, I have to save full URL in DB. This is the way when extension become noticeably slower.

:D Yep, I remember you explained the "categories" names to me. To reduce extra queries and such to gain more speed...

But... I am missing the general idea here. I mean, SEF URLs are created out of regular URLs. IMHO, regular URLs are used to work internally and for queries etc. So, why do SEF URLs have an impact on performance... or in other words: Why the hell can't I modify them to my liking?

In particular those 2 constant parts?!? I can even translate them... but not remove them?!


Sergey
Total posts: 13,748
11 Июнь 2014 00:48

pepperstreet In particular those 2 constant parts?!? I can even translate them... but not remove them?!

Correct.

And this is the way which does not affect perfomance.

pepperstreet So, why do SEF URLs have an impact on performance...

When DB is used, you use it not only for decode URL but to encode it too. It means what any link you see on your page add 1-2 additional queries. And if you have let's say 50 links on your page and each query is only 20ms it is additional one second which is already huge addition.


pepperstreet VIP
Total posts: 3,837
11 Июнь 2014 13:52

Sergey

pepperstreet In particular those 2 constant parts?!? I can even translate them... but not remove them?!

Correct.

And this is the way which does not affect perfomance.

Sorry for being a pain in the rear ;-) ... but I still don't get the idea about the 2 constant parts.

  • What are they used for?
  • Why can't I remove them? (they are not a part of MY cobalt section/category/type structure. Why are they important for routing/SEF?!?)

Sergey
Total posts: 13,748
12 Июнь 2014 01:59

Explain last time. If after that you still cannot understand, I give up.

Each URL have different scructurs.

List of records

index.php?option=com_cobalt&view=records&section_id=7&Itemid=494&lang=en

Record may be different with or without user ID

index.php?option=com_cobalt&view=record&user_id=42&id=143&Itemid=494&lang=en
index.php?option=com_cobalt&view=record&id=143&Itemid=494&lang=en

Now we have to convert it into SEF.

List of records

/sections_name
/section_name/[category_name]

Records

/section_name/[category_bane]/[user_name]/article_title

What is in [] are optional parameters. They may be or may not be in URL

Now you have to decode URL and populate view, section_id, user_id and all other again so Joomla understand that.

Question is how are you gona do that? How you can detect what URL you have. These 2 URLs looks the same

/section/category
/section/article

From this perspective you cannot detect if your view will be records or record and if second segment is an ID of the category or article. But this

/article-list/section/category
/article/section/article

Now you can look first element. If it is article you process

$_GET['view'] = 'record'
$_GET['section_id'] = $section
$_GET['id'] = $article

if it is article-list you process

$_GET['view'] = 'records'
$_GET['section_id'] = $section
$_GET['catid'] = $category

Somethign like this.


pepperstreet VIP
Total posts: 3,837
12 Июнь 2014 12:59

Many thanks for your patience ;-) and the detailed explanation with URL examples. Not exactly what I expected.

Somehow, the 2 documentation articles imply that total custom SEF URLs are possible. At least I thought it is possible.

One last question:

To have total control AND remove any ID# etc. I would have to add another SEF extension?! For instance MijoSEF would use Cobalt URL -> stores it again in DB -> and re-directs to MY custom MijoSEF URL...


Sergey
Total posts: 13,748
12 Июнь 2014 13:33

pepperstreet I would have to add another SEF extension?!

Not necessarily. You can create custom cobalt router PHP fiele.


pepperstreet VIP
Total posts: 3,837
12 Июнь 2014 14:33

Sergey

pepperstreet I would have to add another SEF extension?!

Not necessarily. You can create custom cobalt router PHP fiele.

?!??

Now I am completely confused! That's why I wrote this topic and my dumb questions ;) You answered it can't be done... and I can't even remove the simplest things. Please explain.


Sergey
Total posts: 13,748
13 Июнь 2014 01:26

It is possible to do technicaly. THere is everything to write a router. But it is impossible to do from our side because it will slowdown Cobalt load speed thus we will not do it.


Sergey
Total posts: 13,748
13 Июнь 2014 01:51

Enother try to explain.

We do not always have non-SEF url to work with.

When user land on SEF Url for example /support/community-forum/item/2407.html. Before Joomla load Cobalt, it has to convert this URL to non-SEF so Cobalt can work with it. But Joomla does not know how to do that. It can only convert /support/community-forum in to &Itemid=123 because that part is the alias of menu structure.

Now, how to convert the rest? We need to add option and view at least.

SO Joomla look into menu ID 123 and find what is the extension. Now it loads file components/com_[name]/router.php and call function [name]ParseRoute. In case of cobalt that is CobaltParseRoute($segments).

Now Cobalt have to look into URL and decode URL so later Cobalt can use it as non-SEF URL. Cobalt translate $segments of the SEF URL into non-SEF url parameters.

But how cobalt knows to what we have to translate? So we take first segment with is item or items-list or user-items and buy identifying this segment Cobalt knows how to sonvert segments (/aa/dd/cc) into parameters(&a=aa&b=bb).

Make sense?


andiamine VIP
Total posts: 295
14 Июль 2014 23:31

Goood !!

Работает на Cobalt