Forum

Thread tagged as: Question, Problem, Docs

Multiple options, different output in name and url

'm looking for a solution for this problem: A camping can have two types of tents but some of them have both types. If that is the case, the URL that will be in the output needs to be extended with -sanitairtent which serves a tabbed page and in the name showed will extended with a descriptive <campingname> with bathroom.

If the camping just offers the luxurious type with bathroom there is no extended URL but there need to be the 'bathroom' added to the name

If the camping offers the simple tent there is no extended URL and no description.

So: simple > campingname + URL campingname luxus > campingname with bathroom + URL campingname simple AND luxus > campingname with bathoom + URL campingname-bathroom

It seems easy but I can't come up with the proper execution of it.

This one isn't working but you get the idea (I hope):

<a href="https://www.example.com/<perch:content id="slug" type="slug" for="campingname" />
<perch:content id="sanitair" type="radio" label="tent" options="without|, with|, both|-sanitairtent" />">
<perch:content id="campingnaam" label="campingnaam" title="true" type="text" />
<perch:content id="sanitair"  label="tent" replace="without|, with|bathroom, both|bathroom"/></a>
Olof Fredrikze

Olof Fredrikze 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you'd be better to use a <perch:if> to test for the conditions you want. Radio buttons always have a value.

Hi,

Using <perch:if> solved this problem for the last two years. Now it popped up again. I have tree different 'tents'. If it is a safaritent with bathroom, it outputs the right url-with-bathroom.php The same with url-lodgetent. But if I want to select the simple tent there is no need for changing the URL. So, if the value is 'safaritent' this must NOT be added to the URL

If I just use an empty value there is a ID kind of number added to the URL If I use <if:else> with no value the same is happening.

Is there a way to suppress the value to be part of the output?

Drew McLellan

Drew McLellan 2638 points
Perch Support

As this problem is marked solved, it would be best to post a new item along with the template code you're using and your diagnostics report.