FuturShoc Posted May 24, 2013 Share Posted May 24, 2013 For some reason, $input->urlSegment1 isn't returning a value. Nor is $input->urlSegment2, $input->urlSegment3, etc. I'm just trying: echo $input->urlSegment1; ... but there *ARE* segments in these positions of the page. For the record, I have enabled "Allow URL segments" for that template in PW's control panel. Link to comment Share on other sites More sharing options...
diogo Posted May 24, 2013 Share Posted May 24, 2013 And you activated them on the template also? Link to comment Share on other sites More sharing options...
FuturShoc Posted May 24, 2013 Author Share Posted May 24, 2013 For the record, I have enabled "Allow URL segments" for that template in PW's control panel. Link to comment Share on other sites More sharing options...
Soma Posted May 24, 2013 Share Posted May 24, 2013 It works fine here. Link to comment Share on other sites More sharing options...
diogo Posted May 24, 2013 Share Posted May 24, 2013 hey, now my first answer doesn't make any sense Link to comment Share on other sites More sharing options...
FuturShoc Posted May 24, 2013 Author Share Posted May 24, 2013 It doesn't work for me, despite the enabled template and $config->maxUrlSegments config entry being set up. Is there any other factor which might prevent it? Ok, I've experimented with adding segments to my page URL and I think I see part of the problem. My development base url is this: http://domain.com/clients/lrpa/web/ My page url which doesn't echo my URL segments as expected is: http://domain.com/clients/lrpa/web/business-industry/ However, if I add another segment, like this... http://inthooz.me/clients/lrpa/web/business-industry/test It recognizes "test" as segment 1. SO, it appears that my base url has too many subdirectories which is interfering with PW's segment variables. Is there anything I can do to counteract this affect? Link to comment Share on other sites More sharing options...
Soma Posted May 24, 2013 Share Posted May 24, 2013 That would be 5 segments... what if you set up the max segment count in config.php? Edit: Maybe not really, as the segments are counted from the page url, I don't know of what would prevent it from working. Any modules installed third party? Anything that messes with page view or render or urls? Link to comment Share on other sites More sharing options...
Soma Posted May 24, 2013 Share Posted May 24, 2013 .. but you see the page you're on even when adding /something to the url? If yes it "should" work. Link to comment Share on other sites More sharing options...
Soma Posted May 24, 2013 Share Posted May 24, 2013 I don't really understand what you're trying to say, but I can have as many levels and segments still work perfect. http://pw2-dev.ch/about/what/again-another/level/test/ ...is a page http://pw2-dev.ch/about/what/again-another/level/test/xxx I get xxx as the $input->urlSemment1 Edit: Just to make sure the segments you're trying doesn't actually resolve to a page? Because if PW finds a page it won't have url segments. 1 Link to comment Share on other sites More sharing options...
Soma Posted May 24, 2013 Share Posted May 24, 2013 It doesn't work for me, despite the enabled template and $config->maxUrlSegments config entry being set up. Is there any other factor which might prevent it? Ok, I've experimented with adding segments to my page URL and I think I see part of the problem. My development base url is this: http://domain.com/clients/lrpa/web/ My page url which doesn't echo my URL segments as expected is: http://domain.com/clients/lrpa/web/business-industry/ However, if I add another segment, like this... http://inthooz.me/clients/lrpa/web/business-industry/test It recognizes "test" as segment 1. SO, it appears that my base url has too many subdirectories which is interfering with PW's segment variables. Is there anything I can do to counteract this affect? Still I'm not sure I understand, as it seems to be working. What was the problem again? No matter what I try it always works as it should. Link to comment Share on other sites More sharing options...
apeisa Posted May 24, 2013 Share Posted May 24, 2013 Maybe just confusion about urlSegments vs parent pages? UrlSegments relate to urls that doesn't have page. Link to comment Share on other sites More sharing options...
ryan Posted May 25, 2013 Share Posted May 25, 2013 Maybe just confusion about urlSegments vs parent pages? UrlSegments relate to urls that doesn't have page. That's what I'm wondering too. My best guess is that he's expecting business-industry to be urlSegment1, but business-industry is actually the name of the page. Link to comment Share on other sites More sharing options...
FuturShoc Posted May 28, 2013 Author Share Posted May 28, 2013 Ah, yes, Ryan. That was my expectation. So, UrlSegments in ProcessWire only begin *after* the known page address? Link to comment Share on other sites More sharing options...
Soma Posted May 28, 2013 Share Posted May 28, 2013 That's what I was trying to say in my 3 posts above... Link to comment Share on other sites More sharing options...
FuturShoc Posted May 28, 2013 Author Share Posted May 28, 2013 Thanks for everyone's input. I understand now, though I don't think it was unreasonable for me to expect URL segments to begin right after the base url. Now that I understand the expectation, I can certainly use page name to refer to that segment. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now