Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello all!

Is it possible to use a custom route conditionally.

What I am trying to do is:
I have a button (using anchor tag) to create a department which is set to
Code: Select all
<cms:route_link 'create_dept' />

This works properly and sends the user to the create department form as:
http://localhost/projectname/department.php?q=create


Not the button i mentioned above is visible on this create view also since it is in the header.html snippet. I want to be able to show it on the list view but not on the create view.
Something like:
Code: Select all
<cms:if "<cms:route_link 'list_dept' />">
    <a href="<cms:route_link 'create_dept' />">
        <i class="fa fa-plus"></i> Add Department
    </a>
</cms:if>

so that the button is shown on the list view only but not on the create view.

Is this possible?

Regards,
GenXCoders (Priya)
Image
where innovation meets technology
Info about the selected route (if any) can be found from the context (try placing a <cms:dump /> in your header).
I think the 'k_matched_route' variable should suffice for your use-case.

Hope this helps.
@KK sir,
Thanks a lot. Once again you saved the day.

k_matched_route='route_name'

did the trick for conditionally handling the output.

Regards,
GenXCoders
Image
where innovation meets technology
3 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests