Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
hi,

How can I check if folder of a masterpage is the same as the one in url?

for example:

Let`s say a user visits this URL: http://www.domain.com/mypage.php?pn=THIS-OLD-TOWN

Now, I can display this page like this:
<cms:set town="<cms:gpc 'pn' />" />

<cms:pages masterpage='ob/div_town_template.php'
folder="<cms:show town />" >

How can I check if town exists as a folder ?
I have tried like this but it does not work:

<cms:if k_page_foldertitle = "<cms:show town />">
<div><cms:show town_content />
<cms:else />
<div>please select a town first</div>
</cms:if>

thanks.
Not sure if I follow what you are trying to do but, replying to your specific question, we can use cms:folder_exists tag to confirm the existence of a folder. Usage is -
Code: Select all
<cms:folder_exists 'name_of_folder' 'masterpage_the folder_is_defined_in' />

where the tag outputs 0 or 1 to indicate the absence/presence of the specified folder.
One can use it like this -
Code: Select all
<cms:if "<cms:folder_exists 'some_town' 'towns.php' />" >
    town exists
<cms:else />
    town does not exist
</cms:if>

Hope this helps.
2 posts Page 1 of 1