Read Instructions Here!

More From This User Widget

From KickApps API Reference

Jump to: navigation, search

Have you ever wondered why we don't have a More From This User list on our media play pages? If you have, the answer is simple, we wanted to let you get creative! Now to help you along in the process, we put together a tutorial and some sample code for you!

To make this happen, first create a widget from the widget studio. For the sake of this example, lets make our widget canvas 300px by 103px. Style it however you'd like. This is going to display images, so make sure it is scrollable and easy to view.

Once you've created your widget and you are content with what you're looking at, you can move onto the tough stuff, but considering we've already written the code for you, all that's left is copy and paste.

Prior to copying your Widget embed code into the below script, you must first escape all quotes. To escape quotes all you have to do is add a backslash (\) before the character. Do this for all double quotes (") and for all single quotes (').
Tip: Try using a search and replace in your text editor.

Also, one other thing to realize is that in Javascript, a line break in the middle of a string will break the code. For this reason you must also make sure that your Widget embed code is only one line with no line breaks. Don't worry if the string is wrapped when you insert it into the Global Page Template

<script type="text/javascript">
$j(document).ready(function(){
	if(Ka.Info.PAGETYPE=="Play"){
		
		//Insert your widget embed code between the quotes
		var widget = "";
		
		//Create the wrapper div
		$j("<div id='more-from-user-widget' />").insertAfter('#ka_playPageDetails');

		$j(widget).appendTo('#more-from-user-widget');

		//Generates the feed URL
		var mediaURL = "http://affiliate.kickapps.com/service/searchEverythingAsRss.kickAction?u="+Ka.Info.MEDIAOWNERID+"&as="+Ka.Info.AFFILIATESITEID+"&mediaType=photo,video,audio,blogs&sortType=recent&quantity=25";
		mediaURL = escape(mediaURL);
		var attr = $j('#more-from-user-widget object param:eq(1)').attr('value');
		var attr = attr+"&mediaURL="+mediaURL;

		//This will make the code compatible with Firefox
		var ff = $j('#more-from-user-widget object').attr('data');

		$j('#more-from-user-widget object param:eq(1)').attr('value', attr);
		$j('#more-from-user-widget object').attr('data', ff+"?mediaURL="+mediaURL);
	}
});

</script>

Did you enjoy this tutorial? Have questions, comments, or want to submit one of your own? Contact us at support@kickapps.com.