Jump to content

URL segments vs matching tree path


SamC
 Share

Recommended Posts

22 minutes ago, SamC said:

I tried to use it before but was so confused with it.

That was my initial experience as well. It served me well in the absence of xDebug (still use Tracy quite often, though), but now that I got it running again (by manually removing __debugInfo methods()) I don't use it as much.

Console feature is immensely useful, you'll love it.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
On 18/09/2017 at 10:07 PM, abdus said:

One handy tool when using urlSegments is to hook into Page::path and modify $event->return, so you won't have to manually building urls everywhere you need. You still need to implement urlSegment logic though, changing Page::path is a passive operation, it doesnt change routing behavior

I know this an old thread, but can this be explained a bit more. I'm writing a tutorial about URL segments and this could be useful. I ask this because I can foresee the manual building of URLs to demonstrate how URL segments work. Although this would suffice for the tutorial, I'm curious about this hook as I'm getting more into PW now.

Link to comment
Share on other sites

On 9/20/2017 at 12:47 PM, SamC said:

I tried to use it before but was so confused with it

Hi SamC - sorry you find it so confusing. I would love to revamp the "docs" in that blog post into a proper set of docs, but I just don't have the time. If you come across things you don't understand, please ask in the Tracy support thread. It has a huge number of tools, but the key things are the automatic reporting of errors, the dumps panel using bd() calls, and the Console panel. If those are all you get familiar with, that will be of great help.

  • Like 1
Link to comment
Share on other sites

Hi @adrian to be fair, I haven't really sat down and tried to learn it properly. When I do this, I could always document it and use what I learned for a small tutorial for beginners. I'm seeing most things I do in this way at the moment and I've found that documenting stuff really increases the solidness of what I've learnt, it sticks, no forgetting it two weeks later.

Right now I'm constructing a tut about URL segments. However, because the page tree most of the time matches the natural URLs for a site, I'm finding it tricky to even find a use case!

  • Like 2
Link to comment
Share on other sites

1 minute ago, SamC said:

I've found that documenting stuff really increases the solidness of what I've learnt, it sticks, no forgetting it two weeks later.

Absolutely - the best way to learn something is when you have to teach it to someone else!

  • Like 3
Link to comment
Share on other sites

hey @adrian

what about creating a wiki page for tracy debugger? I played around with that on gitlab today because I'm looking for an easy and good way to write docs for my module too. I didn't get readthedocs to work properly... Gitlab/hub wikis seem to have all i need: Write Code easily in the Browser, copy&paste screenshots (very handy!) and automatic table of content creation and dividing content into several pages and sub-pages.

see here: https://gitlab.com/baumrock/test-readthedocs/wikis/neue-testseite

also gifs work. and collaboration would easily be possible too.

not sure how docs would work for different versions of a module though. but all the pages have a history so that should not be a problem...

Link to comment
Share on other sites

@bernhard - the problem with the wiki is that you can't do a PR, which is why I went with Github pages (as discussed in the Tracy thread). The problem with Guthub pages is that don't support custom jekyll templates so you can't have a sidebar, which is really annoying. I could code up a page from scratch, but then we're getting into more work again. Honestly I am thinking about just putting all the docs in the ReadMe - that way they would also be available via @netcarver's module release notes. I would store the screenshot images in the /docs/ folder because I have that excluded via .gitattributes so the download would still be light, but the ReadMe within PW would looks really nice. Also, really easy to accept PRs for changes to the ReadMe file.

  • Like 3
Link to comment
Share on other sites

2 hours ago, SamC said:

Right now I'm constructing a tut about URL segments. However, because the page tree most of the time matches the natural URLs for a site, I'm finding it tricky to even find a use case!

There you go: https://www.szepelet.com/products/

There are two parent categories: product-categories and skin-concerns but the tree is:
- products
- categories (not this one nor children are frontend accessible directly)
    - product-categories
         - cat 1
         - cat 2
    - skin-concerns
         - cat 1
         - cat 2

I did not want to do product-categories/body-care because there would also be skin-concerns/body-care but those two body-care categories are not the same, even though they are called the same (client's request...).

So I explode and implode parent_child in order to create these "combo categories" on the fly by using URL segments. But this is just one example, any kind of tags an categories are good candidates for URL segments.

  • Like 1
Link to comment
Share on other sites

6 minutes ago, SamC said:

What would be wrong with 'product-categories/body-care' and 'skin-concerns/body-care'?

It would not be explicit but another thing I forgot to note is that there is no /product-categories/ nor /skin-concerns/ pages accessible by design, so what would happen if someone tried to go there?

6 minutes ago, SamC said:

Nice site btw

Thanks, not yet done just happens to be live ;)

Link to comment
Share on other sites

13 hours ago, szabesz said:

It would not be explicit but another thing I forgot to note is that there is no /product-categories/ nor /skin-concerns/ pages accessible by design, so what would happen if someone tried to go there?

I see the point, but I would personally expect a page /product-categories/ and the same at /skin-concerns/ which lists the actual menu items (in the right sidebar) but if they're not there by design then URL segments are win :) 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...