Jump to content


Photo

Investor area, best way to layout permission-only pages

roles member area

  • Please log in to reply
25 replies to this topic

#21 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 788 posts
  • 205

  • LocationMidlands, UK

Posted 20 April 2012 - 06:11 AM

Thanks Diogo, will give this a try!

#22 ryan

ryan

    Hero Member

  • Administrators
  • 5,771 posts
  • 3108

  • LocationAtlanta, GA

Posted 20 April 2012 - 08:49 AM

Thanks Ryan, but correct me if I'm wrong, if we wanted say the 'rates' for 'Property 1' in the properties section, then the page properties/property_1/rates would still need to be created in the backend? So essentially each property would end up with a child, all called rates?


When you enable the URL segments option for a given template (Templates > Edit Template > URLs > URL Segments) then PW will accept non-existant URLs, so long as they start with one that does exist. So lets say that you have a page called /products/widget/. If URL segments are enabled, then you could access any URL below that and it would be sent to /products/widget/. So accessing /products/widget/photos/ (a page that doesn't exist) would still get sent to /products/widget/. (If URL segments are not enabled, then of course accessing /products/widget/photos/ would generate a 404 instead.)

Using the /products/widget/photos/ URL, the 'photos' portion would be considered URL segment 1. You can check the value of URL segment 1 in your template file with $input->urlSegment1. If there were another segment on there too, like, /products/widget/photos/cats/ then 'cats' would be URL segment 2 ($input->urlSegment2), and so on.

The advantage of URL segments is that you can have just 1 page handling many URLs. The portion of those URLs that are translated to URL segments are not pages in PW. In fact, if you actually created a page in PW named /products/widget/photos/, then your 'widget' page would no longer receive the 'photos' URL segment, as the new photos page would then have control over it.

#23 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 788 posts
  • 205

  • LocationMidlands, UK

Posted 20 April 2012 - 10:35 AM

When you enable the URL segments option for a given template (Templates > Edit Template > URLs > URL Segments) then PW will accept non-existant URLs, so long as they start with one that does exist. So lets say that you have a page called /products/widget/. If URL segments are enabled, then you could access any URL below that and it would be sent to /products/widget/. So accessing /products/widget/photos/ (a page that doesn't exist) would still get sent to /products/widget/. (If URL segments are not enabled, then of course accessing /products/widget/photos/ would generate a 404 instead.)

Using the /products/widget/photos/ URL, the 'photos' portion would be considered URL segment 1. You can check the value of URL segment 1 in your template file with $input->urlSegment1. If there were another segment on there too, like, /products/widget/photos/cats/ then 'cats' would be URL segment 2 ($input->urlSegment2), and so on.

The advantage of URL segments is that you can have just 1 page handling many URLs. The portion of those URLs that are translated to URL segments are not pages in PW. In fact, if you actually created a page in PW named /products/widget/photos/, then your 'widget' page would no longer receive the 'photos' URL segment, as the new photos page would then have control over it.


Thanks Ryan that sounds exactly what I was looking for. So in theory I could put an include within an if urlSemgent test and output a whole new template. This would basically allow me to replicate EE's templating system somewhat?

#24 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 788 posts
  • 205

  • LocationMidlands, UK

Posted 21 April 2012 - 11:02 AM

Just wanted to say thanks to all of you for helping me out with this, it works perfectly as expected, if a user has the credentials I can send him off to another template with private information and if they don't they'll just see the normal page. The client can add all the necessary information under one entry so this is very powerful and easy at the same time!

#25 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 788 posts
  • 205

  • LocationMidlands, UK

Posted 01 November 2012 - 07:04 AM

Sorry, just running into another issue with urlSegments. I have enabled urlSegments on my "students" template so that

/students/geography includes a geography_students.inc file.

My problem is that underneath /students/ is the "student" template so

/students/joe-bloggs displays using the "student" template but I want to add a link to "edit profile" from this particular student page and I'm trying to include an "edit_profile.inc" file but I don't know whether this would be a urlSegment2 of the "students" template or a urlSegment1 of the "student" template.

I have tried both, but neither seem to work, any ideas on how to implement this?

Thanks gang!

#26 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 788 posts
  • 205

  • LocationMidlands, UK

Posted 01 November 2012 - 07:19 AM

Scrap that, think I have sorted it, I've reallowed urlSegments for the "student" profile and it seems to be working, thanks.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users