Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to make a poll for my website.The poll I want should look like the poll on http://www.premierleague.com/en-gb.html.I am not sure if I should use PHP,Javascript or etc to make a poll.Can anyone help me in this? Thanks...
You're going to need to create a form and receive the data on the server side using PHP. Then you're going to put that information into a database.
I hope I do not come across as too mean but, the decision on which language to use is pretty simple when compared to actually coding it. I'm betting you are not entirely experienced with web-based programming languages. I would strongly suggest you look for some pre-made scripts in the interim:
Here is a simple tutorial on creating polls: http://code.tutsplus.com/articles/creating-a-web-poll-with-php--net-14257
If you are OK with the idea of using a CMS, Here is a WordPress Plugin that should do the trick: http://code.tutsplus.com/articles/creating-a-web-poll-with-php--net-14257
Otherwise, it's important to understand the flow of data:
Display the poll to the end user (use HTML forms and CSS to style)
Client submits data (either built in submit functionality or Ajax)
Server Receives data and stores it into database (php)
Page is re-loaded and results are displayed (read with php, then displayed using html/css)
In other words, you are going to use many of the available languages and tools to create a polling script.
Start with a pre-built one and look up other resources to learn to make/customize your own.
If you need to save poll values, than PHP/MySql + JS for live effects, animations + CSS for styling.
Create database tables.
Create HTML form.
Style form to fit your needs (maybe jQuery UI).
Use Ajax to submit form.
Use PHP to gather information form user, validate it and save to database.
Reload user poll view to see changes.
Sell this masterpiece to Google/MS/Apple (or any other company).
Take big cup of hot chocolate.
Rule rest of the world.
Good luck.
Yes, you can use PHP or any server side scripting for validating, storing, processing poll, and use HTML/CSS/JS for client side, this is the main whole web page. You should also have DBMS (Database Management System) like mySQL, msSQL, etc., for storing poll answers.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am developing a Django application for a school project and it is essentially one page that takes user input and another page that responds to the user input by displaying various alerts/data.
The end goal is to have the application launch on a tablet and display the user input page while having the summary data page displayed on the monitor. The issue is that as of now, these two are communicating via localStorage values. Obviously this will need to be changed down the line.
I am extremely new to Django and web dev so I was wondering if this is even a feasible task and what the right approach would be?
In short, yes this is something Django can do.
Fundamentally right now your application is just a client. You need a server to both:
A) use a database to store your data (whatever you currently store in local storage), and
B) share that data with your two clients
Django is a web framework designed to create such servers, so it's a great option. However, Django also requires knowing Python. If you don't know Python, and aren't learning it in a class, you may instead find it easier to use a different tool: Node.js
Node lets you use Javascript the same as other languages (eg. Python). It also has frameworks (eg. instead of Django it has Express.js). But again, if you don't mind Python, Django is a great choice.
Whatever your choice of framework, your first step will be to understand how it sets up "routes" or "endpoints" to talk to your client (you'll also have to learn how to have that client "talk" using fetch or $.ajax).
Once you master that, you can then learn to use a database to store the information you need, and finally you just "connect the dots" between those routes and your database to create your server.
I should warn you though that this is a sizable project, involving several complex technologies (servers, databases, AJAX, etc.) I actually teach a college class on server-side development, so please understand I speak from experience when I say that ... even to make a simple server with a little bit of data ... you'll have to learn a lot (with Django or any other tool).
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Never mind. I've found the correct answer
I think you have already all pieces in front of you, but don't know where to start.
I suggest that you
find an exciting Bootstrap blog template (like the free ones at Start Bootstrap)
understand the code, which is usually a good mixture of HTML5, CSS3, JavaScript with a modest use of jQuery
tweak it with your own ideas
if you have some special needs not covered by the template (for example collapsible menu items), you can browse the Bootply Snippet Library to look how others coded it.
Nowadays no web programmer starts from scratch. They choose a template with the basic structure of a one-pager, multi-pager, blog, e-commerce, etc. and start from there.
By the way: Alaboudi mentioned in his answer that you need to learn MySQL, too. This is indeed needed for dynamic content like e-commerce and blogs, but not for static content like business websites that don't change that often, but put an emphasis on individual page layouts.
But to get your first website up fast I would start with static websites and later extend your knowledge to MySQL.
Everything you have learnt is great, but you must also learn a database querying language (SQL). May I suggest you start learning MySQL, its very friendly for beginners. Now let me give you an example of how to code a dynamic website.
Lets consider facebook profile pages as an example. Firstly you must realize that there isnt 1 billion uniquely saved profile pages made for each user on the server. Rather, there is only 1 html css template that is filled in with appropriate information depending on the person loading the page. When the visitor comes to his profile page, his information must be queried from the database using a backend language (PHP in your case). Once the result of the call is retrieved, you fill in the appropriate information in your html (name, age, friends, blah, blah) and send it over to the user. So technically you are constructing the complete page with every call and you never actually have the complete page saved on the server.
Long story short, you should look into using a database.
This is not really a question. I would suggest you to go and code something.
You want to do a blog? Ok, try to do it with what you've learned so far.
When you'll start to build it, you'll have specific questions on specific problems, you can then search on Google your specific problem or come back to StackOverflow and ask for it.
Any resource is good and lucky you, there are plenty of resources on the internet ;)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What I would like to get some help with dividing a website in pages, similar to how a forum is organized.
What I mean is that for example a thread has at most 10 posts and when you post an 11th, the oldest post will go to Page 2 and continue that way. Whats the best or easiest way to achieve this? Are there several ways of doing that with HTML alone, or html and Javascript, or PHP?
The concept of what you are describing is called pagination.
Pagination in web content
On the Internet, pagination is used for such things as displaying a
limited number of results on search engine results pages, or showing a
limited number of posts when viewing a forum thread. Pagination is
used in some form in almost every web application to divide returned
data and display it on multiple pages. Pagination also includes the
logic of preparing and displaying the links to the various pages.
Pagination can be handled client-side or server-side. Server-side
pagination is more common. Client-side pagination can be used when
there are very few records to be accessed, in which case all records
can be returned, and the client can use JavaScript to view the
separate pages. By using AJAX, hybrid server/client-side pagination
can be used, in which Javascript is used to request the subsequent
page which is loaded and inserted into the Document Object Model via
AJAX.
Server-side pagination is appropriate for large data sets providing
faster initial page load, accessibility for those not running
Javascript, and complex view business logic.
Correctly implementing pagination can be difficult. There are many
different usability questions such as should "previous" and "next"
links be included, how many links to pages should be displayed, and
should there be a link to the first and last pages. Also ability to
define the number of records displayed in a single page is useful.
Also you can read this for comparison of pagination algorithms.
Paging is something you're going to want to do on the server with PHP before you get to HTML. The primary goal of paging is to conserve bandwidth. (You don't want to send 1000 records down to the browser if the user is going to stop reading after the first 10.) There are also performance and usability concerns.
The actual implementation varies wildly depending on your toolset, database technology, application framework, and personal preference.
If you're using MySQL, you'll want to look into OFFSET and LIMIT, which will allow you to select "pages" of data for a query. It may be as simple as adding a couple query string parameters to your URL and passing those on (being careful to clean them of any SQL injection attacks, of course) to your existing query.
I don't know if I can be more specific without having more details about the code you're working with.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
There are a lots of new frameworks, technologies coming up. And it's becoming so hard to follow up all of them. One of the thing that confuses me is client side frameworks. I heard that Angularjs,Backbone,Knockout,jsviews,knockback, SPA... are the most popular right now.But I can't understand how does the security concept applies? If we take an example of querying a table form database it's now possible to make queries from client side database, by specifying table name and fields and etc... So if it works that way, than everyone else can write another query and get all other information. I am pretty sure that I am missing something very important here, and it doesn't click my mind. So please can anybody explain me where can I start learning those primitives.
I really appreciate, and I am really eager to learn but I am searching it wrong way I guess.
Whatever the framework used, the security matter will still the same, and very similar to mobile apps:
which data can you afford to be handled in an untrusted environnement
which treatment can be applied in an untrusted environnement
By "untrusted environnement" I mean the browser itself. You have to understand that any code executed in the browser can be corrupted by a medium/good JS developper.
Data security suffer the same threat: giving access to data from your client means that you do not control anymore who is using it.
Once you've dealt with this simple matter, it became easier to decide what must stay on server side, and what can be deported to client.
That said, there are various ways to make data/algorithm steal more difficult:
Obfuscation that comes with minification
Double data validation (forms for example): both client and server side
Authentication protocols, like OAuth
Binary over webSockets, instead of plain json and ajax call...
The browser sandbox imposes some limitations, but mainly to protect the local computer from damages due to malicious JS code. It does not protect your code nor your data from being seen and manipulated by the user itself.
I am using angular for some of my projects. I haven't used other frameworks , but in angular you usually consume an API to get the data. You don't query your database directly. So, the responsability of securing your data is more in you API (Backend) than in your angular client.
You can use OAUTH, or other security method that you want to make your api safe.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 months ago.
Improve this question
When viewing iGoogle, each section is able to be drag-and-dropped to anywhere else on the page and then the state of the page is saved. I am curious on how this is done as I would like to provide this functionality as part of a proof of concept?
UPDATE
How do you make it so that the layout you changed to is saved for the next load? I am going to guess this is some sort of cookie?
Any up-to-date client side framework will give that kind of functionality.
jQuery
YUI
GWT
Prototype
Just to name a few...
Regarding the "saving" (persistency, if you will) of the data, this depends on the back-end of your site, but this is usually done via an asynchronous call to the server which saves the state to a DB (usually).
I hate to give a short answer on this, but there are several dozen different JavaScript libraries that provide this type of functionality, and lots of tutorials and howto guides available on google:
http://www.google.com/search?q=javascript+draggable
Some JavaScript libraries/frameworks you might want to take a look at:
jQuery
MooTools
Yahoo User Interface (YUI) library
It's amazingly simple with jQuery. Check out this blog entry on the subject.
Edit: I missed the "state of the page is saved" portion of the question when I answered. That portion will vary wildly based on how you structure your application. You need to store the state of the page somehow, and that will be user dependent. If you don't mind forcing the user to restore their preferences every time they clear their cookie cache, you could store state using a cookie.
I don't know how your application is structured so I can't make any further suggestions, but storing a cookie in jQuery is also amazingly simple. The first part of this blog entry tells you almost everything you need to know.
One method not mentioned here is that starting with ASP.NET in the 2.0 framework, Microsoft unveiled something called WebParts which enabled the building of controls which could be dragged and placed in the same way. This was supposed to be an easy method for users to create their own Web 2.0 style portals.