Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 2 down vote accepted

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=''></script>
share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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