Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
3 posts Page 1 of 1
Unfortunately, original tag <cms:link> chokes if parameter masterpage='' not provided i.e. No masterpage, no link..
There is a solution!

All pages in CouchCMS have a unique numeric ID, assigned by database for each created page and available to us in the variable k_page_id.Therefore masterpage input from user is absolutely not required in such case since it can be taken from database.

What I did works very reliably:
1. Can get a link if masterpage is unknown, empty but id is provided => by getting masterpage from db and feeding it to original tag.
2. Original tag's param is called page_id, my mod allows a synonym id as well.
Code: Select all
<cms:link id='12345' />


The rest of the usual parameters work as expected (refer to http://docs.couchcms.com/tags-reference/link.html ) and masterpage is required for any parameter other than 'id'.
Hello,

Thanks for this addon.

However I tried it filling the id attribute with the name of a view but it didn't work. The name is supposed to be the unique id or I missed something.

Here's the code I tried :

<a href="<cms:link id=button_link_unmissable_1 />" class="button"><cms:get "button_unmissable_1_<cms:show k_lang />" /></a>

button_link_unmissable_1 being a variable containing the name of a view

Could you give me some clarification please ?
@atmospheric,
The 'id' param actually expects the 'numeric' ID that MySQL automatically assigns to each record internally.
Since you are passing a string instead, it is being ignored.

button_link_unmissable_1 being a variable containing the name of a view
None of the other params accept the name of a view directly. However, you can set the params that relate to a particular view to get the desired link e.g. for a 'page_view', you can set the 'page' param with the name of the page whereas for a 'folder_view' you may set the 'folder' param with the folder's name.

Please see https://docs.couchcms.com/tags-reference/link.html for details.

Hope this helps.
3 posts Page 1 of 1