How to create an advertisement?

How to create a "classified advertisement" web site?

  • I would like to develop a web site to host classified advertisements. This site would allow users to enter an advertisement (e.g., text plus image) via a web page and have the advertisement posted on the web site. There would need to be a mechanism to take payment for a posted advertisement via a credit card. It should be possible to view posted advertisements by category (e.g., cars, boats, etc.), date of posting, asking price, and so on. It should also be possible to remove advertisements (both the user and administrator should be able to remove advertisements). My question is how to develop such a web site. Specifically: 1) What learning resources (books, etc.) exist to teach me how to create such a web site? 2) Are there any example "programs" that would be helpful to study? 3) What is the fastest way to develop such a site? 4) What is the best way (best = scalable and reliable) to develop such a site? 5) What is the easiest way to host such a site? A good answer will point me to books and other resources that can teach me the necessary ?web programming? skills to allow me to build the above described web site. These resources must contain example ?code? to allow a quick start at getting something up and running. A good answer will also outline more than one way to build such a web site focusing on both Windows and Linux solutions and will discuss trade-offs between the various possible solutions. You may assume that I have good programming skills in C and Perl, understand how a web server works (e.g., have created static content web sites), but have no experience in creating dynamic content web sites.

  • Answer:

    Hi, Well this one is right up my alley, thanks for dropping in an asking it, there's quite a bit to talk about on this subject, but I'll try to keep it close to the goal you have here and if you have questions afterward about something I didn't spend enough time on, then just drop a Clarification note. For your qualifications here (on the development, not your skills) you are going to want to use a template engine, a good one, and something that is rather fast, because of the nature of your site goals. Smarty is probably the answer for you in this department. I'm sure your skills in Perl have introduced you to the idea of template design, and if not, at least object design.. same thing when you look at it in the dim light and squint your eyes. They are the same in goal however, that being 'if you've made it once why make it again?'. With a large site like this, and one that needs to get larger, templates are the only way to go. There are literally hundreds of template engines, all over the place, and all of them are basically the same. Smarty stands out for a number of reasons however. First of all it complies the code once you are finished and keeps it that way, so the pages which are more or less static are very fast, and the ones that are more dynamic than static are faster than they would be otherwise. Also, the system is very pliable, with a very good support team. The website is at smarty.php.net .. and the url there should tell you something. Most of what you want to do has already been done by guys like me more times than we care to think about. Login's, customer accounts, billing, email lists, blah blah blah.. over and over... each company thinking that theirs is different, .. well they're not. They are all basically the same. This struck the good folks over at Pear with the idea of 'why keep doing this?' make one libary, have a bunch of coders make it really good and just use that. How many ways can you access a data base anyway? So that's your next stop, Pear. A collection of code gone over by several hundred coders over many years, and fine tuned down to very clean working functions and objects. DB.php for instance is a library that will give you all the functions you need to access, insert and query reports from just about every database out there today. It is very popular because when you need to change from one database to another or just want to support another, it is very easy to do if you started out with DB.php to begin with. If nothing else, it is a repository of very clean, well written code that you can learn a great deal from. Your next stop should be a few places that are open source and have made these types of programs. You may find that just getting one of these and making a few alterations to the system is a much better way to go. If you go this route be sure you understand the OpenSource license terms, and how they affect a commercial site. I have worked with several companies in the past that have used open source systems, having me make a few tweaks here and there to suit their needs, and it has always worked out very well. A couple of them used the software only for a couple of years while their in-house staff created the 'real' system. Others had this in mind, but remained with the Opensource. Just be sure you understand the license, and what license you have. There are several and they are not all the same. A few of these classifieds sites are : ( in no particular order ) PHP Classifieds http://www.deltascripts.com/phpclassifieds/ NetClassifieds http://www.scriptdevelopers.net/products.php#NCSummery Trueque: An Open Source Classified System http://trueque.sourceforge.net/ PHP Nuke has a Classifieds system as well. (not really sure what they don't have) http://phpnuke.org/modules.php?name=News&file=article&sid=6842 Repositories of OpenSource projects are good to browse around in before you start coding, they are great sources of ideas, and possibilities, and could possibly help you find a way to create a classified based website that stands out from all the rest. The two main websites I can think of with thousands of projects on them, are Fresh Meat http://www.freshmeat.net and Source Forge http://sourceforge.net These are sister sites, but very different... like.. um.. sisters. To get your bearings on PHP as a language, don't go out and buy a bunch of books. Go to the source http://www.php.net On top of having great documentation on the language, something the Perl commity hasn't seem to gotten around to doing really on the web. We have site after site of Perl code and writings, but nothing that falls into that large space between "hello world" and Object AI. The Perl book is fantastic, so I guess that's why we haven't spent a great deal of time there. But, PHP didn't have a PHP Book, so they make a website, since, that's what they do really. What they also did is allow coders to give insight to the uses and methods of just about everything on that website. Every function (just about) has entries from knowledgeable coders explaining some of the Gotcha's and giving hints on how to get the most from this function or that method. This is not a forum, its not a place where newbies can ask questions, its a place where guys who hammered their heads on the keyboard, until they figured it out, came to help other coders save their keyboards. So, go there first. Then, if you want a book you can find a better one, after you have a good idea of what it is you need. A place where newbies can go and ask questions would be : http://www.webmasterworld.com/home.htm I've been known to stop in there and answer questions myself, and there is a core group in the PHP area that is really very good, and patient. I wish I could spend more time there, but life is like that sometimes. The site owners keep a great deal of history, far more than I would have thought with as much traffic and posts as they get there. This right here has given you a huge field of information. Really. I have 5 PHP books sitting on my shelf and not a single one of them come close to the information in those areas I've given you here. Kinda makes me mad. ;-) But it is the truth. If you want something to thumb through, go with the PHP Cook book, but really, if you can't find it .. Easily .. on those sites, its probably not in the books either. Where you will want to start .. The amount of information in those resources is a problem in and of itself really. Its huge and so I'm going to set you on a course with your goal in mind, as to where you want to start. You know how to configure the server, that's good, but what you may not be use to, and what will be a cold shock some morning , is that PHP differs from Perl CGI in many aspects, the most glaring in the security area is that template files and config files are right out there in the directories, where if called by the right name, show up in text format .. ah.. bummer.. CGI is hidden, it is not even in the directory, and executes in the directories they are in, so a text file give complier errors and that's about it. So brush up on your .htaccess configurations. You would be surprised to see how many password.txt files there are out there on the web, just sitting there. (you don't have to wonder, just do a Google search for password.txt filetype: txt and you'll see them. I make it a charity hour at least once a month sending these site owners messages about this). As far as PHP goes however the two areas you want to master first, is MySQL and Sessions. Both of these are amazing in what they do. I love Sessions. It is a bit hard to grasp at first, but those comment areas on the PHP.net site will see you through this area. And what they don't cover, you can get help on at WebMasters and looking at the source at Pear. What a Session is, is a cookie really, a cookie that stays on the server, and can hold gobs of information. Not just scalars, but arrays, and even objects. The client browser gets a cookie with a unique id given to them by the web server. This identifies them during this visit's session. As soon as the browser closes, or if they leave it idle for too long, the session ceases, and the information you have on the server, all those arrays and objects, gets cleaned up automatically. If the browser refuses the session cookie, then all of the links and form buttons on the site, instantly get the session code attached to them. So, again, the id still gets passed. It looks cleaner in the address bar when they take the cookie, but it doesn't really matter. Sounds cool huh? That's what I said a few years ago when they first came out, and for the longest time I couldn't get them to work. So that's your first stop. Master those and your world becomes so much simpler. Next is MySQL, and I'm really wracking my head to remember any trouble I had in this area. But I can't think of a single thing right now. with DB from Pear and the PHP native functions available, any thing I had, is already solved, but with your site, you will want to understand MySQL very well, as well as the differences in persistent connections and non persistent. There are times to use both, don't let them tell you other wise. But knowing when can be a toss up at times. After those two, and maybe even a bit during those to, I would spend all my time getting to know Smarty. That is the tool that will save you weeks of coding, and hours of debugging. But that isn't even the half of it really. That is the cool stuff for the coders, like us. But the Designers get it just as good. I've worked with four designer teams since I started using Smarty seriously last year. Each of them looked at it, after I showed it to them, and said "ah man, this is going to really hurt" (cleaned up for public broadcasting there). Within two weeks however, they were all over it. They couldn't get enough of it. Smarty separates your code, from their design. They can do all the things they've always wanted to do, but couldn't because they had to work around the coder. And you get to not have to answer the phone and change reams of code every time there is a design change. They can change what ever they want to... I'm sure there are limits, but I'm not the one to ask about them. Until you really start understanding and using Smarty to at least half its potential, you simply don't get it. I didn't. Not for the longest time. Like I said, templates are all over the place, and there is a reason for that, it simply doesn't make any sense to create a dynamic website without them. The first time you start working on a site of any size at all, and you have just block and copied your last 15 pages of code from other pages of code and your realize that you are spending far more time in HTML land than you ever wanted to spend, you start thinking "there has got to be a better way than this.." And your Perl heritage is yelling in the back of your brain "Yeah there is! Let me at them! " Ha.. just a note on that line, of a personal nature, when I first started working with PHP, I was in that spot, and being new I didn't have a full grasp on all the tools (mainly because all these tools weren't around then, but that's beside the point really), so I wrote a Perl script to code out the skeleton of the PHP code I needed. Seriously. I still have it some where. It runs through an SQL file, makes all the objects, case statements and %80 of the typing needed to create the forms and other HTML pages, I knew I was going to need sooner or later. It was a God send, it really was. Then I read one of these 5 books I have, Advanced PHP, which had the first template outline in PHP I had ever seen, so I ditched the Perl script and started fleshing out that thing. Saved hours of time and taught me a great deal of useful PHP stuff working on that library. When I first saw Smarty, my thought was, "so what? I do that now." but I didn't. It just looked like I did on the surface. Never mind the compiler (though that is very cool), What these guys have made is a smart template as well, which I didn't have, not even close. I guess I'm going to get into this a little so, hold on to your eyes. Normal template stuff, the stuff I knew about anyway, is exactly that, templates. Stencils. You make the HTML page, and put marks in like {$firstname$} , {$lastname$} and when you run the PHP script, it fills in those areas with the first name variable and the last name variable.. and that's about it.. Perl has this as well, so you've probably seen it yourself. It is a heck of a lot better than the alternatives, that is for certain, but .. well. its not really all that fun is it? Hard to get excited about being able to make a form like that.. You could put in blocks of code too, like {$searchbox$} and {$header$} for the pages to build up, so you could save a great deal of time just doing that, and making a library of modules to use with your templates. It certainly was not a waste of time. Smarty's templates are a bit better than this. Let's say you have one template that gets the Search Box. Most of the pages in fact on your site have the Search Box. But there are 10 or 15 that don't. The "contact us" page for example, doesn't have it because of the room requirements. So, that's a new template, right? Nope, that's just not sending that template the search box code. Templates in Smarty have logic. {IF $searchbox} {$searchbox} {elseif}$advertbox} {$advertbox} {elseif} {$smarty.config->ImageFill} {$smarty.config-Imagefill} {/if} Kinda cool eh? The first two things there $searchbox and $advertbox are for your code to check and send if it has/needs to send them. That last, the config call, is for a config file variable, in the Designer's realm. If they have something they want to stick in there, they can, using config files with very simple layouts. They can change it basically at will, and can just take it out if they don't want anything there, or .. even change the template code pointing to the Config variable to another config variable, or .. have the template call a completely different config file. it's up to them, you don't care. Your job was the first two. Theoretically, any template should be able to change at will, but I've never seen it happen in real life, on a real site. Smarty however has over come just about all the real life stuff that happens which keeps that from being a reality. So, that's your third stop, and perhaps your first and second desert visits as well. Here are some other links of interest, which I visit at least once a month to see what is going on in my world. I really don't know where these other coders get the time, they must be better Smarty users than I am, after all I'm still learning there.. :-) Links of Note FedEx Shipping API http://www.fedex.com/us/solutions/shipapi/sample_code.html?link=4 SSL Certificats for Free ( no kidding, and they are very reasonable for the long term ones as well.. they give you a short term one for free though, so you can get your SSL area developed and working for the client without being out of pocket) http://www.freessl.com/starterssl/starterssl.html Cross Browser (DHTML on steriods, very cool stuff here). http://cross-browser.com/ Measuring the Capacity of a Web Server http://www.cs.rice.edu/CS/Systems/Web-measurement/paper/paper.html Torture.pl (so you want to see how good you code really is?) http://stein.cshl.org/~lstein/torture/ PayPal Developers Support Forum http://www.paypaldev.org/ PHP Documentor http://www.phpdoc.org/ Using Smarty Templates With PEAR HTML_QuickForm http://www.thelinuxconsultancy.co.uk/smarty-guide.html PHP Editors http://www.php-editors.com/ PHP Snippets : PHP code Snippets Library http://www.php-csl.com/snippets/ CSS Cheat Sheet http://php-programming-goodies.euweb.cz/css-cheat-sheet.html CSS Zen Garden (Now, if you really want to see some dynamic action, go here.. its amazing.). http://www.csszengarden.com phpWebThings http://www.phpdbform.com/ I'll add this one (kinda like PerlMonks, but.. not.) Has some good stuff some times though. PHP Builder http://www.phpbuilder.com/ Regular Expression Library (yeah, we have those..) http://www.regxlib.com/ Okay, that should cover just about everything you could need until, .. you need more. Experience is that thing you get right after you need it anyway. thanks, webadept-ga

ken13-ga at Google Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.