I am developing a small web application in CakePHP which allows user to create contents using tools I provide. Once user is done creating the contents, I want to give an option to embed that in her own website.

There are 2 ways I can think of right now to do this

  1. Using iFrame embed code
  2. Giving unique link to that content

Are there any better ways to generat an embed code?

Later on I would also like user to give style (css etc) to the contents she has created.

  • Not sure what a unique link with content achieve? how would the user use a link to display content on their site? I would go with the iframe option, they only thing you will need to be aware of issues of "compact policy" (IE only) and cross browser styling issues.
    – Darknight
    May 19 '11 at 8:14
  • Unique link is a public URL for that content. In case user wants to redirect to this link he can do that.
    – abhi
    May 19 '11 at 9:39
  • in that case give both options.
    – Darknight
    May 19 '11 at 9:58
  • Yes I am going to give these 2 options but was wondering if there are better ones.
    – abhi
    May 19 '11 at 10:05

You can use Javascript. The script tag can point to a piece of JS on your server the JS would insert a div (or iframe or whatever you want) into the users html document.

The JS script can also be dynamically generated (by PHP, Python, Ruby, etc.) which is how the JS would insert the correct content.

so for example:

<script type='text/javascript' src='http://yoursite.com/content_embed.js?content_id=1234'></script>
  • Yup, this answer is perfect.
    – Jordan
    Jun 9 '11 at 0:03
  • I agree. It is perfect. Thank you very much kylek.
    – abhi
    Jun 9 '11 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.