Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web hiearchy and URLs
#1
Let's say my page structure is set up like this:
- category -> subcategory -> product

The url should be:
- www.ex.com/category/subcategory/product

however, when I go to the product page, the url is just like this

- www.ex.com/subcategory/product

What can I do to match the URLs with my web hiearchy completely?

Thank you
Reply
#2
GetSimple generates URLs with a maximum of two levels. It would be nice it could have more, I'll submit an issue to the svn.

Meanwhile, if you're interested, I can post here a quick patch I've made (requires editing two core files), that makes GS support three levels in URLs.
Reply
#3
(2012-11-09, 07:04:42)Carlos Wrote: GetSimple generates URLs with a maximum of two levels. It would be nice it could have more, I'll submit an issue to the svn.

Meanwhile, if you're interested, I can post here a quick patch I've made (requires editing two core files), that makes GS support three levels in URLs.

Thank you for your reply.

I would be glad if you could provide the patch.
Reply
#4
Yeah I never understood the limit of 2 levels. Was this a fancy url limitation on the htaccess?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
Dirty patch for GS 3.1.2.
(Disclaimer: use at your own risk; not officially supported; I don't know if it may have conflicts with some plugin; it will be undone if you upgrade GS)

Edit admin/inc/basic.php, around line 400 you'll find:
Code:
    if ($parent != '') {
        $parent = tsl($parent);
    }

Remove all that and replace by:

Code:
    global $pagesArray;
    if ($pagesArray) {
        foreach ($pagesArray as $page) {
            if ($page['slug'] == $parent) {
                if ($page['parent']=='')  {
                    $parent = $parent.'/';
                } else {
                    $parent = $page['parent'].'/'.$parent.'/';
                }
                break;
            }
        }
    }

Now edit admin/edit.php, find this (line 131):

Code:
        <div class="edit-nav" >
            <?php

Just after that, and before the if(isset($id)) { line, insert this:

Code:
            getPagesXmlValues();

and around line 166, remove (or comment out) this:

Code:
                        getPagesXmlValues();

(So we've just moved up that sentence.) This is just to fix the "View" button when you edit a page.

PS This is a temporary workaround. Now I'm thinking about other ways to do it.

(2012-11-10, 00:38:12)shawn_a Wrote: Yeah I never understood the limit of 2 levels. Was this a fancy url limitation on the htaccess?

No, GS's .htaccess works ok with any number of levels.
It's the way links are generated (find_url). As GS doesn't store the site structure anywhere, you have to obtain the parent somewhere (I did it with global $pagesArray, but I don't like searching the array so many times...)
Reply
#6
Thanks a lot Carlos.

Is it possible to create a plugin out of this in the future?
Reply
#7
I hope GS supports multilevel urls in some future version.

Until then, I'll think about some other way to do this with a plugin. But almost for sure it will also require some small change to the core, though I'd like it to be easier and more efficient that the quick hack I posted.
Reply




Users browsing this thread: 1 Guest(s)