开发者

How to create a blog plugin?

开发者 https://www.devze.com 2023-02-15 08:36 出处:网络
Actually not sure on the terminology of what I\'m trying to do. I have a dynamic page (php) that I w开发者_运维百科ant people to be able to \'plugin\' to their blogs. A couple lines of code that when

Actually not sure on the terminology of what I'm trying to do. I have a dynamic page (php) that I w开发者_运维百科ant people to be able to 'plugin' to their blogs. A couple lines of code that when inserted, insert the php page into their blog, like Google has a few lines of code to add Adsense into a page.

This is what I have which I think is right but how do I get the html, do I just use a post? There must be a simpler way?

<div id='fill'></div>
<script type='text/javascript'>
??? Code to get html ????
$("div#fill").html(html);
</script>

EDIT:Tried to reexplain


You could just use a simple html iframe:

<iframe src="http://www.google.com" width="50%" height="300"></iframe>

More on iframes: https://developer.mozilla.org/en/HTML/Element/iframe


If I understand you correctly now, you just want to load the contents from another site and embed them within your site.

PHP's file_get_contents will allow you to load whatever the other site's code is, and you could manipulate that with JavaScript/DOM, or use it in your .html() function (I won't go further now because I still don't know if that's what you really want).

Or you could just embed it within an iframe.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号