Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
23 posts Page 3 of 3
Hi, thanks!
However I would like to use it for all modals sharing, not for this specific one.
I found a working solution here:

Is there a way to disable these security features of couchcms, when needed?
Perhaps the more universal script you found is a better solution, but just for completeness let's try and finish solving this with a shortcode.

You can build a shortcode that will accept the modal's ID as a variable and embed the script using that modal ID. Usage would be [open_modal id='article-42'].

Code: Select all
// Modal Opening Shortcode
   // embed script to open a modal on page load.
   // Usage: [open_modal id='article-42']
   $FUNCS->register_shortcode( 'open_modal', 'open_modal_handler' );
   function open_modal_handler( $params, $content=null ){

      global $FUNCS;

      extract( $FUNCS->get_named_vars(array(
         'id' => '',
      ), $params) );

      return "<script>$(document).ready(function() {  if(window.location.href.indexOf('#" . $id . "') != -1) { $('#" . $id . "').modal('show'); } });</script>";
Hi tim, thanks!
Anyways, I didn't want to open modal on a page load - just to be able to share a link, which will open the modal when used.

In this line of thinking, I am unable now to use any link sharing snippet on the modals in order to share them, again because couchcms would escape the <script> and all such sharing links require a bit of javascript...

An advise how to override/turn off the couchcms security feature escaping " or <script> on ad hoc basis - for a particular modal would be very useful.
23 posts Page 3 of 3