Getting Variables when useSeoUrls = true

5 posts by 2 authors in: Forums > CMS Builder
Last Post: July 8, 2015   (RSS)

By theclicklab - July 8, 2015

Hi there, 

I have a page setup with the following type of url structure using useSeoUrls:
/destination.php/greece-8/

What I want to do is add variables to this so I can swap out page content e.g.

URL: /destination.php/greece-8/photos/
Page: If URL contains "photos" show photos

URL: /destination.php/greece-8/factfile/
Page: If URL contains "factfile" show facts

etc...

I'm not sure how to extract this from the url when using useSeoUrls

Many thanks

By gregThomas - July 8, 2015

Hey,

I'm not sure what useSeoUrls is, could you give me a bit more information on it? I'm guessing it's a system for adding rules to htaccess?

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By theclicklab - July 8, 2015

Yep, its part of CMSB. It's an options for load viewer library:

https://www.interactivetools.com/docs/cmsbuilder/viewer_options.html

By gregThomas - July 8, 2015

Thanks! I wasn't aware of that feature in CMSB. After looking at how it sends variables, if you add /photos/ to the end of your URL, the system will add an empty variable called photos to the request array. So you could detect if photos is in the URL using the following method:

<?php if(isset($_REQUEST['photos']): ?>
  <!-- photo html and code goes here -->
<?php endif; ?>

Isset is used to detect if a variable exists, and will return true even if the variable is empty, contains zero or null. So this code will check if photos  was sent in the URL, even if it's empty. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com