Forum for discussing general topics related to Couch.
13 posts Page 2 of 2
Code: Select all
$FUNCS->register_shortcode( 'soundcloud', 'soundcloud_handler' );
   function soundcloud_handler( $params, $content=null ){
      global $FUNCS;

      extract( $FUNCS->get_named_vars(array(
         'url' => '',
         'height' => '166',
         'width' => '100%',
         'params' => 'color=0066cc',
      ), $params) );
    $src = "$url" . "&" . "$params";
   $html =<<<EOS
<iframe width="$width" height="$height" scrolling="no" frameborder="no" src="$src"></iframe>
EOS;

   return $html;
   }


Sorry, try this - I'm terrible at making small mistakes. The woes of coding, haha.
Image
I have been able to solve the issue. I copied the iframe code from soundcloud and pasted it on my website and then visited the url. From the page source I compared the iframe outputs of both your code and soundclouds code and realised the kfunctions.php code was supposed to be this instead:
Code: Select all
$FUNCS->register_shortcode( 'soundcloud', 'soundcloud_handler' );
   function soundcloud_handler( $params, $content=null ){
      global $FUNCS;

      extract( $FUNCS->get_named_vars(array(
         'url' => '',
         'height' => '166',
         'width' => '100%',
         'params' => 'color=0066cc',
      ), $params) );
    $src = "https://w.soundcloud.com/player/?url=" . "$url" . "&amp;" . "$params";
   $html =<<<EOS
<iframe width="$width" height="$height" scrolling="no" frameborder="no" src="$src"></iframe>
EOS;

   return $html;
   }


I added this
Code: Select all
"https://w.soundcloud.com/player/?url="
to the $src variable and now everything works as expected. Thanks so much for the help. I very much appreciate it. God bless you
Thank you for sharing the solution!

Trying to figure it out at 7am with no sleep was not a good idea, lol.

My mistake on the $src var, I was only going from the official soundcloud iframe code - I didn't look at output though only at the given short tag / iframe code!
Image
13 posts Page 2 of 2
cron