I have to use php,mysql to do a prroject.I have chosen to make a simple forum and use a lot of Ajax with it.since i am still a novice, can you guide me to a simple ajax guestbook which i can work on to make a forum? i want to end up with something like this but even simpler. http://board.fuzzylime.co.uk/
It's not terribly complex. Just set up a MySQL database, and use a PHP script to connect to it, check for a login, and add a record for a post or list records to view a post.
If you are just starting out, I would suggest that you first understand the basics of building a forum in PHP.
Personally I liked the forum example in this book . I thought it was explained very well. You can also just google for "PHP forum tutorial" to find a couple examples, like this one and this one.
Once you have the basic idea figured out you can start looking at how to make an AJAX style implementation. For that, you can also just google AJAX tutorials and go from there. Either way, I think if you are going to build a forum, its important to understand the basics behind building a forum before jumping into a more complicated example like an AJAX driven one. Understanding the PHP portion of the application, and the database behind the whole thing is a very important step.
Related
I have a website for a client offering information from a database. But other websites want to show that information in their website, so my client ask me for it.
Since the begining I thought it might be something similar to the twitter widget. As I want to give out a code similar to this:
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({ ......
And other websites will show the information from my database.
But I cannot find a exactly example, I found this: http://tutorialzine.com/2010/03/who-is-online-widget-php-mysql-jquery/
But it is not exactly what I want.
My deployment is the following: In the server I've got a mySQL database and a website, I would like to create php and javascript code (or even jquery, but I'm not very expert with it) so other website could incorporate the information from the database in a secure mode.
Could anybody give a hint?
You'll need a RESTful service on your server which other sites can ping. You will use an AJAX request to get the information from that service.
The big piece of this for you will be creating a JavaScript object that has all the functionality you want. It is much easier to give people directions on how to use your REST API and let them implement it via AJAX on their own pages. If you really do want a full widget, you'll want to check out a lot of things. First is closures in JS to ensure you don't conflict with any of their variables. Also make sure you are good at developing cross-browser Javascript independent of libraries. And finally, you'll want to make sure your server is configured for cross-domain AJAX requests. Again, my recommendation is to set up a REST API for them, and let them do the dirty work.
There is an interesting tutorial about how to create a twitter widget using PHP and JavaScript on the nettuts website, I think you may find it useful.
Well, although it's not specific for PHP, this is by far the best resource I could find to this subject:
http://alexmarandon.com/articles/web_widget_jquery/
Our client would like to be able to edit a few pages on their website that we just built. Now I know this probably doesn't deserve something like Wordpress, but something very small probably just custom built where I store the page information in the database.
I just wanted to see if there are any suggestions to make sure I have the right plan here and see if there are any security issues or better solutions.
So I figured I would just store the 4-5 pages text in a database using TEXT. Then I would create a little backend page for them to log in and have access to edit the content with a simple WYSIWYG editor, and hit submit and it updates the database.
I know it sounds super simple but is there any problems doing it like this? Is there a better solution out there without having to implement the whole site like Wordpress?
Edit: Thank you for your responses. I ended up going with PageLime (thank you Maggie!) I remember hearing about it before, I read that article on nettuts a while back but never really acted on it but PageLime is PERFECT for what I was looking for.
It does exactly what I need and more! I love it, I recommend it to anyone :)
I took exactly the same approach in my project. Users enter/edit their text in separate application and store it into database. And this data is later read and inserted directly into HTML.
Later they wanted to add images and hyperlinks and do more advanced stuff for some pages so I started to use CushyCMS - it's free and quite simple to use
This answer is a bit, too late. Its here for anyone else stumbling on the same question.
I found CouchCMS do the same job but self hosted.
Nonetheless, CushyCMS and PageLime are also very good
In an effort to give a website im working on more functionality, im wanting the ability for readers to post comments/thoughts to the stories they read.
any ideas the best way to go about this?
ive tried Google but the minute i add the word "comments " + html or php etc (assuming i can do it in these languages) then google just gives me methods to commenting on code....
Any ideas, tips, tutorials etc ill gladly jump on.
Thanks in advance
-somdow
Well the most popular embeddable comment system is probably Disqus. Besides that you will have to look if there are plugins for your framework of choice - or just roll your own (a comment system is basically just like any other database backed PHP application - and there are many ways to implement these).
Why not just look at how popular content management systems have implemented comments? (For instance, take a look at how Drupal and Wordpress do it.) The manner in which you build a comment system will depend on your needs and the limitations imposed by the structure of the system you're trying to integrate it with.
You should work out your database schema first. I'm assuming you're writing all of this from from scratch. You haven't given a lot of details.
It will be easier if you put your comments in a separate table. Make sure you have some basic protections against bots(captcha, etc.)
Sort the results by the timestamp.
comments_table
Id
UserId
UserDisplayName
ArticleId
Comment
PostTime
Disqus is nice, I must say. If you want code that you want to copy/paste, Google Friend Connect is a different route you can take... Almost everyone has a google account and it only takes a few minutes to set up. They also have some sweet other widgets you might want to try out like rating, etc.
http://google.com/friendconnect
If you really want to customize it just how you want it, I would create your own commenting system with a MYSQL database to store all your data. You could even use some nice jQuery animations when they write / delete a comment. (I just did something simular to that and it's really nice).
Whatever works best for you -- roll with it!
Good luck,
Coulton
I've been googling around for a really simple way of making what is, in effect, nothing more than an enhanced phpMyAdmin.
In a mysql database, I have:
Name, address, phone, website etc, plus 2 or 3 custom fields. This data is pulled out to make a website.
All I want is to be able to make a freeform form, a bit like Access, but for the web, and the only thing I want to do over and above normal field editing would be to have a list of when I contact them, what was said, and perhaps a reminder when the next action is due. It also needs to implement some basic permissions so that different users can access different subsets of the data.
I've looked at so many CRMs my mind is boggling, and they all do WAY more than I need. I don't have leads or accounts, all I have is the need to make sure than when I update the person's details, and for that data to be in the same DB as my site is generate from.
I'm happy to learn if I can get pointed in the right direction, and I have a feeling that something like what I want might lie in the direction of jquery. It's just that there's so much good jquery stuff about, I can't see the wood for the trees!
Thanks.
If phpMyAdmin doesn't quite do it for you, it sounds like you just want a simple little web application.
jQuery is probably barking up the wrong tree. It's just a javascript library. While you could certainly use it to spiff up your little application, it's not going to get you the core functionality you need.
I would just dig in and write a little PHP script that does exactly what you want. Even if you're not very experienced, this would be a great learning project.
There are lots of tools which will generate forms including Phpeanuts, phpFormGen, Delphi for PHP, PfP Studio, FormFields, phpMyEdit (and many more).
I've not looked at Radria for some time - previously, it was more of a CMS/page layout/mashup thing rather than a form generator though.
C.
As has been said, you need to build a web interface.
One simple thing you can use is something like Django's admin panel or Ruby on Rails' script/generate scaffold functionality. If you can run Rails or Django, try those.
If you are tied into PHP, consider using one of the PHP frameworks. I'm no expert on them - some of my PHP-using friends have good stuff to say about Symfony (the alternatives: Cake, CodeIgniter, Zend). A bit of random Googling tells me that Symfony has an admin generator that may be quite like that of Django.
As has been said, jQuery won't do what you need, although you can use it.
Apologies if this is not the right place to ask but here goes...
What should I use to create a simple web application for our website?
I'm the IT guy for a small non-profit. On our website we have a page with a large form in which users can fill out information on an application form. The information gets sent to a MySQL db. This data can then be accessed and edited by a couple of members of staff behind a logged-in part of the website. There's only two dbs being used: the main one with all the data and the one used for login details for the web app. It's all done with PHP and functionally is fairly simple - just a form with lots of fields to collect data and a basic secure "manager" page to do a bit of stuff with that data.
The problem is that we need to make changes to the app, and to extend its functionality quite a lot. I have a little bit of experience playing around with PHP but I've taken one look at the code used and decided it'll take too long to decipher it and see what's happening where. The code is uncommented and a bit of a mess.
I'm starting to think that rather than investing time to relearn what little I knew about PHP and untangle all the code, I might invest the time in learning another language and/or framework to get this done. I want the resulting web app to be a lot easier to maintain in future by me or anyone else who comes along and has to make a change.
Would you recommend using Django/Python for a project like this? Zend/PHP? Just PHP and notepad? I want the app to be done fairly quickly so the less steep the learning curve the better. Many thanks for you time.
Another good PHP framework is CodeIgniter.
They also have a good webcast that outlines how to begin with the framework as well as create a simple blog [tutorial].
I would recommend a PHP framework, such as CakePHP. Spend 20 minutes of your time and follow their blog tutorial.
Using PHP alone can be tricky, especially when you will have to deal with security issues.
From what I can see you have asked 2 questions.
1. Should you maintain and extend the current code base or do a rewrite?
Rewrites always take longer than you think. And even if you do the rewrite to avoid learning the codebase you would still need to learn the current codebase to ensure you capture the current functionality before adding any new features in the rewritten codebase.
I would keep the current codebase and maybe do some refactoring as you add features.
What should language and frameworks should you use?
I would stick with PHP, CakePHP is a solid framework and so is Zend. I would read up on both and do a couple of tutorials and make your decision.
As Anax states, I'd suggest that you look to use PHP. If code is already implemented then you have a start.
PHP isn't hard to re/learn. I know some don't like it, others like it but simple fact, either way it isn't hard to learn. But, more importantly consider the following:
You obviously have access to the hardware stack required to use PHP and MySQL. Introducing a new language/technology may cause unforeseen issues with getting a production site set up.
Now this doesn't mean that you can't write certain components in other languages. You could, if you were so inclined. But you probably shouldn't be so fast to get rid of PHP just to learn another language. Do you have important (technical) compelling reasons to use something other than PHP?
If you are mostly concerned about the spaghetti code in place, you can get that anywhere -- even new development. Better to re-factor the code and fix and add to what you have than start from scratch.
I can offer some general considerations:
Whatever language you choose, get a good IDE for it. Having automatic syntax validation and code completion helps a lot if you're a beginner. Don't use plain text editors.
Teaching yourself how to code well will make for a very frustrating experience unless you have a lot of patience. This generally comes from being really sure that you want to do it.
Be very conservative in your time estimates. Having many setbacks is guaranteed if you're a beginner.
Start out by focusing on reading about writing code, not focusing on writing code. If you're learning Python, read the official tutorial first. The same goes for PHP.