How to make dynamic widgets in PHP - php

I want to make a dynamic widget to show votes on a particular topic.
I want to make a copy/paste widget so that other site can show vote via copy/paste html/js/css code provided by me.
It's similar to how we use js/html code for showing bookmark & share tool.
Can anyone give any ideas how to do this ?
Thanks in advance.

To do this you nead to use a swf file.
Javascript deny it for security reasons.
View this Link:
Zero Clipboard

Very simple to say, you can have a php class for taking votes for a particular topic from database. And a controller class that calls this method. With a simple xmlhttprequest or just using simple post function on JQuery, you can get the votes and show them in your html. If you provide more details i can provide more detailed solution.

Related

Getting a discussion forum /query support on my website

I want to have a forum like thing on my website.I dont want any complicated thing, just the user must be able to post questions and the administrator(that is me) can answer them..(It would be nice if it has tree like structure but even without that it is fine) ..All the users can read the questions on the forum anytime(obvious) ..I dont want to put phpbb3 or any such readymade tool..I just want to be it simple (something like this scroll to the bottom) ..How to get this thing done..If possible in php please tell that..Otherwise tell other options..Please help me out..
You could probably do something like this in WordPress. (Your local webserver would need to be running MySQL as well as PHP to achieve this.) At the simplest level you could set up a page and allow user comments on it.
A really simple way is just to have a basic form with text-input, textarea, and submit button. Then have the person input their name, question, and submit it. Make sure you validate the form with js and/or php. Then update a password protected page that only you can access with the name and question. Then using whatever cms you have for this page (or just static html if you have the patience) you can just update the front page with the new question and answer above the form.
The best way, though, is going to be some kind of "readymade" system that you tweak...

How do i create functionality for allowing website users to add a page to my website?

So for example wikipedia, yahoo answers, or even stack overflow.
I'm trying to create a site that will allow users to create new pages of content to add to my site for other users to view.
I'm reading an introductory book on php/mysql. All i really want to know is will i find what i need in there? Is PHP what i would use to achieve that? Or do i need to use something else?
Also any general suggestions pointing me in the right direction would be greatly appreciated!
Thanks!
Why not just download MediaWiki for your site?
Yes, PHP and MySQL is what you would need, since you are creating dynamic pages. You would use PHP to process the HTML form submits of pages, and use MySQL to store the data. You would then use PHP to list all of the pages that users have made.

Facebook link inspector

I'm building a website and am looking for a way to implement a certain feature that Facebook has. The feature that am looking for is the link inspector. I am not sure that is what it is called, or what its called for that matter. It's best I give you an example so you know exactly what I am looking for.
When you post a link on Facebook, for example a link to a youtube video (or any other website for that matter), Facebook automatically inspects the page that it leads you and imports information like page title, favicon, and some other images, and then adds them to your post as a way of giving (what i think is) a brief preview of the page to anyone reading that post.
I already have a feature that allows users to share a link (or URLs). What I want is to do something useful with the url, to display something other than just a plain link to a webpage, to give someone viewing a shared link (in the form if a post) some useful insight into the page that the url leads to.
What I'm looking for is a script, or tutorial, or at the very least someone to point me in the right direction, so that it can help me accomplish this (using PHP preferably).
I've tried googling it but I don't know exactly what such a feature would be called and google isn't helpful when you don't exactly know what you're looking for.
I figure someone out there, in this vast knowledge basket called stackoverflow, can help me with this. Can anyone help me?
You would first scan the page for URLs using regex, then you would parse the pages those links reference with a php DOMDocument. You could use the parsed document to obtain any information you need from the webpage.
DOMDocument:
http://php.net/manual/en/class.domdocument.php
DOMDocument->load (loads a file, aka a webpage):
http://php.net/manual/en/domdocument.load.php
the link goes through http://www.facebook.com/l.php
You pass a URL to this and facebook filters it.

Need help with google's search feature of pre-displaying the website

I have been thinking about this new( I know it has been a while ;p) google's feature that displays the website in the search result.
What i don't kind of get is, how they did it? Is it a form of iframe? or is it a php render of the page? Is it dynamic JavaScript/Ajax? I am just very curious how they have done it? And the follow up question would it possible for us to duplicate for our own sites? Like a search result page to display the page on mouse hover.
Any assistance would be most appreciated? I searched everywhere i could not get a definite answer anywhere?
The thumbnail is rendered by some kind of browser engine, and stored in an image file. There are lots of providers of this service, for example Thumbshots, WebSnapr and ShrinkTheWeb.
It is a thumbnail rendered on server side, and stored in an image file.
There are questions on SO dealing with how to do this, e.g.:
How can I generate a screenshot of a webpage using a server-side script?
How can I take a screenshot of a website with PHP and GD?
How might I obtain a Snapshot or Thumbnail of a web page using PHP?

get a facebooksource page

for one project, i need to get the facebook source page (html one) via a php application.
i try lot of method like curl, file_get_content, change my ini_set, etc.... but facebook never let me get the html result file.
Does anyone can help ?
for example this page :
ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']);
$data = file_get_contents("http://apps.facebook.com/is_cool/?cafe_action=album&view=scroll",0);
Print strip_tags($data,"");
Thanks a lot.
Damien
Comment 1 :
- I need to create 2 application. I want to parse the html code to get some information from one to the other. I don't want to duplicate or take the facebook code. I just want to make a "view source" (like IE or firefox) and put it on a file, without ask my users. When my user is logged in my first application, i just want to is is credential to get the other content.
The reason you're having problems is that the majority of the facebook homepage content is loaded via AJAX. The data is not hardcoded into what your browser renders.
You should think of a different way to accomplish your goals. If you tell us a little more about what you're trying to do, we can probably help you find an alternate method.

Categories