Create and Search user posts in PHP - php

This is my first entry into backend development, taking mostly a design role in past projects. Im working on a personal project and have fleshed out what I feel is a logic of sorts. Just a few very basic user tasks broken down.
Core User Actions:
A user can create a new posting
A user can find posts from other users by tag, date created, and
other content. This is done in kinda a central search area. (Search
string: "Dog Saddle", retrieves posts with mentions of dog saddels,
dogs, and saddels)
A post's creator can be contacted from the post.
A user can delete their created posts.
I need guidance/suggestions with the following:
What data should I capture for users?
What framework is best for the application dynamics I've described? (ROR, Python, PHP ect. I'm a one man team currently)
Are there open source projects I may gain reference from?
I'm very dedicated to learning on my own, and can make use of good advice!
Thanks,

Given the rather generic requirements you've outlined and that you are just entering into the development arena, you should try an established framework. That way you won't need to write everything from scratch. You'll still have plenty of control, but the benefits of many commonly used functions, classes etc that will speed up your development.
Give something like CodeIgniter for PHP a try. See http://codeigniter.com/. There are a lot of tutorials online to help you get started. For example, see http://net.tutsplus.com/sessions/codeigniter-from-scratch/.
What you've described doesn't suggest a particular language at all. ROR, Python, PHP--you could use any of those to create what you've described. PHP is considered by many to have a less steep learning curve than ROR and Python, which is why I recommended it. However, there are frameworks for these other languages as well that will give you the same benefits as code igniter.

Related

Should I use a simpler framework or CMS to meet deadline?

TL;DR:
Boss needs site up and running yesterday. BackEndGuy1 uses zend framework 2 and is going way too slow. BackEndGuy2 (this is me) was hired to help BackEndGuy1 meet deadline. FrontEndGuy and BackEndGuy2 decide that using Zend will take forever, so they want to switch to an easier framework or a CMS. What should they choose? Expression Engine? Codeigniter? Concrete5? Something else?
A friend of mine and I have a major decision problem. We’re working on a site that has to be up and running as soon as possible. My friend works on the front end along with an artist, and I work on the back end along with another guy. Actually, I was only recently hired because the boss and the rest of the team decided that the other back end guy needed a speed boost. That other guy thought that using zend framework 2 for this job was a good idea. As a result, I’ve spent the last couple of weeks trying to learn zf2 (which is very hard to do, believe me) and doing php and javascript patchwork on existing code. Plus, I have the boss frequently hovering over my head and asking “What do you think? Are we going to be up before Christmas?”, to which I try to respond in a diplomatic way like “Anything is possible with hard work and determination!”, but my honest opinion is “Sorry, this is impossible. At this rate it’ll probably take a month or two…”.
Bearing in mind that (a) the other back end guy practically stopped working on the site after I was hired (we only talk on the phone when I need him to explain parts of his code) and (b) there is still a considerable amount of work to be done on the back end, my friend and I decided that a switch to a different tool will probably give us the boost we need. I’ll try to give a brief but comprehensive description of what we are trying to build, and I’d like you to help us find the best option we have.
Ok, so the site we’re building will be a place where people will publish *candies* for sale and other people will browse published *candies*, and if they find one they like, they will be able to contact the publisher. It is important to note that no transactions will take place over the site. We will only provide a means for publishers to show off their product and customers to contact the publishers. Roughly, the pages / functionality we need are:
home page
*candy* search based on *candy* properties (with pagination, filtering, sorting… etc)
individual *candy* page (as viewed by publisher (editable) and customer)
publisher page with contact info and product list (as viewed by publisher (editable) and customer)
login and registration functionality for publishers
maybe some static helper pages I forgot to mention
Now, many of them are already working (e.g. the search page, with all the desired features, is ready), but there are many things left that have to be done using zf2 and I have no idea how to do them…
What we need now is something that (1) is easy to pick up, (2) is fast to create stuff with and (3) has as much out-of-the-box functionality as possible. My friend (the front end guy) is leaning towards Expression Engine (money is not a problem), because being it a CMS he will be more comfortable with it too, and also because he noticed that we will be needing a lot of its built-in features.
His only concern is that it may not be as customizable as a framework. The framework solution we are considering is Codeigniter, as it fulfills criteria (1) and (2). Another option I am considering is Concrete5. I just watched a couple of introductory videos and I was amazed by the in-place page editing functionality and the block system they use to dynamically add content to pages.
What is your advice? What would you do in our position?
There is quite a big difference between a CMS and a framework. I think you should make that main decision first, before going to details like which one is better.
Also, using a different tool might get you up to speed, but the fact that you need to ask, suggests that you are not very experienced in those other tools as well. Other tools also have a learning curve, even the easy ones, and besides, you will have to start over completely, not being able to take along the work that is already finished.
So I would recommend to stick with zf for now. If you are going to make a switch, maybe Drupal or even a CMS like WordPress would be better and easier. Also, I think it is important to tell the boss what the status is and what problems you have. You can then decide on the best strategy, and let the boss define the most important features, so there will be at least something if not everything before Christmas. Better to have some functionalities working and being usable than having nothing at all.
If you're going to be doing all the work, then switch to a framework or CMS that you already know.
If you don't know any, either stay with Zend & take whatever time it takes (making it clear to the boss what's happening), or get out now.

Designing auto-generated html form from MySql database using PHP

I'm building a simple internal website for a medium-sized independent restaurant chain. The website will be a repository for contact information, general documents, etc. We have a central kitchen that produces and delivers around 50 different items daily to the 7 different restaurants in our city. We currently have a pen, paper, and phone tag system for placing these orders. The part of the site I am struggling with is creating a section for ordering these items through the internal site.
The website can be logged into currently from each restaurant's unique user id, and there is a mysql table for each restaurant's daily order. I need to create an html form that allows the manager of each restaurant to enter integers for each item and have that information update as a new record in the mysql table. I know it should be a straightforward task, and one that an advanced php programmers would scoff at...but that I am not!
Any help at all would be appreciated, even a reference to an open-source solution that is well documented that would help me in getting started!
These classes can also help you :
Form auto generator ( A Simple class for creating HTML forms )
Forms generation and validation ( A professional class using for Form generation and validation )
You may want to consider using a Framework as #hakre suggested in this comment. From a business perspective using a Framework is a time and money saver because you're not having to create the wheel when something in the Framework already exists:
symfony
Zend
and a dozen others would accomplish what you want but would take some time learning them right out of the box.
These, and many other frameworks, have form generators (command-line utilities or open sourced available Code Gallery classes), that make the forms from your database schema.
But this would only be the LONG term solution as this would eventually allow you to customize your site to exactly want you want but would require resources from an experienced developer to maintain.
I think you may also want to look at phpmaker, they have a trial. But essentially you point it at the database > enter the connection information. and it will generate add/remove/edit/delete
I just used it to build a couple sites to administer my databases on the backend. Since I didn't need it to be all pretty and colorful for the end-user experience, it was very useful, and customizable for straight data management.
PhpMaker is really powerfull choice. I have used it for many applications.
If you are a PHP programmer, you can go deep and do most every customization you want.
You can also install some advance extensions like ilovephpmaker.

Multiple Blogs in PyroCMS (or other OpenSource CMS)

I have been looking round for an open-source CMS framework that I can use as the basis for a few web projects. I used to use Joomla, but I found it to be clunky and out-dated, certainly too complicated for the average user that would be faced with it.
My current project requires a content-managed website, with all the usual stuff, and on the whole PyroCMS seems well suited to the task. However a core requirement of the project is that it contains four blogs. A general one for news relating to news in the client's field and then one each for the three members of the company.
I can't see how to do this as it stands, but I'm sure it must be possible somehow. I'm happy to write a module myself to do it if needs be, but I'm trying to keep the project fairly simple, and I can't be the first person to want to do this!
I'd considered a Wordpress network, but a key requirement is that everything is centralised in one administrator panel.
In summary - is there any way to maintain several blogs using just PyroCMS and addons?
Thanks,
Ian
There are a few outstanding features that have never really been added into PyroCMS as they have never really been needed by anyone with enough interest or ability to add them.
The blog module is VERY basic, but it has always been used by incredibly simple sites. "Mom and Pap" websites, simple "News" sections on corporate sites, developer blogs, etc.
Out of the box it CAN be done, by making a pages for "blog" and a category for each, then use the {pyro:blog:posts number="10"}{title} {summary} {/pyro:blog:posts} tags.
It's not the cleanest solution, but remember that most development on PyroCMS is done by developers finding gaps that need to be filled for client projects. I have a client project coming up soon that requires multiple categories (surprised it took so long!), which would solve this problem perfectly, but until they pay me to work on it I just don't have the time. If you want the feature added in for your job I can help you with it if needs be through giving advice on here, in the forums, on IRC etc, then we can merge it in easily enough.

CMS design patterns and considerations

I am creating the cms for a relatively simple site - portfolio, some general content pages, custom blog etc.
What are some of the best patterns to consider before diving into the design.
I want the system to be as flexible as possible without being too complex.
I have looked for some good resources that discus cms and blog design but can't find anything too good.
My language is php but I suppose I am looking for more language independent advice.
Flexibility without complexity... nice program.
Maybe you're a genius and you will make something that feet your needs. But I think the biggest problem you will face is security and robustness. So really, take other advices on this page and have a look at wordpress, drupal, joomla and ezpublish. A lot of security stuff is already done. And not only security...
So, study some of these tools, track their flaws, check their security policy. Study how they handle caching, sessions, bootstrap, absolute & relative url managment, documents (images, videos, etc), ajax, authentification, identification, acl, user interfaces, rich-text editing, migrations, templating, page composition, content filtering (I try to remove the things you won't need, plugins, database abstraction, fine caching, css and js minification, all the extra-complex stuff not needed for a single instance simple CMS). Soon you'll have a 'picture' of the stuff they've done.
By doing this work, you'll certainly notice some big differences, and mistakes. You'll start going on irc and flaming developpers, telling them that others have done better choices. You'll start forgetting to shave. You'll maybe do some contributions. Some will be accepted, others won't. Old core devs doesn't like when someone explain why they made mistakes (and they make mistakes).
Now, comes the day you have a beard. Some of your contributions will start looking like forks. You will have ennemies, and friends, or followers. And you will start feeling the force.
And you will go on irc and tell god that the world is ugly and that you'll make the first CMS which will be flexible without being complex. And people will cry. And birds will run in circles. And you will be able to explain what are the design pattern of a CMS.
I am a user. I know what I want. Doing what I want will make user happy. I'm happy.
You shall not trust code from people with glasses
"MVC MVC MVC" : and the people responds 'that shall be done'
Seriously, There's still a place for a good CMS with disruptive innovation, the fork history has started long time ago with phpNuke (as far as I can remember). But some of the actual products are really fine for most tasks.
I'm probably risking the reputation here, but my experience shows that building your own CMS can be a very justified decision, especially when you get familiar with current opensource systems and understand what exactly they lack in terms of features, security or what not. Open-source often means a lot of backward-compatibility concerns and bad architecture decisions that cannot be easily changed.
I strongly suggest that instead of just taking on MVC you take a look at ideas that make it attractive.
One main problem with CMSes is the range of technologies involved in driving dynamic web-sites: imperative php for logic, declarative SQL for data queries, markup HTML for interface, imperative/functional javascript for dynamic interface, JSON for ajax calls etc. To keep the system manageable you have to keep these technologies in a controlled and understandable environment, but yet allow for smooth integration. Knowledge and best practices are out there. MVC is but one approach to manage this problem.
My choice at the time was to use the following principles:
Object-oriented code with static calling (php is a one-run thing, many instances of code objects are rarely justified), nothing except for one line of init code in global context
100% code-design separation with the use of XSLT and custom content processor
Custom router that can take any http request and reroute it to registered methods
Custom content processor that can take arbitrary method output and convert it into any usable format such as xhtml, xml, json etc. based on the request parameters (i.e. http://local/class/method.xhtml, http://local/class/method.json)
One copy of code for as many virtual web servers as necessary
SQL query builder (chosen for flexibility over ORM) for all database queries
Mandatory filtering of method input with filter_* functions
I believe you can choose a few that you like :) And good luck!
A good pattern to start with is the Model View Controller pattern, or MVC.
This pattern suggests to seperate your application's logic in the following layers: data logic(model), manipulation or business logic (controller) and display logic (view).
This is a good pattern to start with as you'll run into other problems (and thus patterns) along the way.
The following website explains the MVC concept quite well: MVC Principles
There is no point reinventing the wheel unless you are trying to better it in anyway.
THere are a lot of CMS available already. I personally have worked with ezpublish. There are other options such as drupal etc. This is the list of all open source cms avaliable - Click here
If you are just trying to learn then you can perhaps pick any one of the popular opensource and work on them to find its architecture and design.
Besides, I dont think anyone can give you a list of design patterns that would be best for a CMS tool. Because each design pattern solves some particular problem. And, you just have to choose a design pattern depending on a specific problem you want to solve in your project.
These days, writing your own CMS is a horrible waste of time. The usual open source solutions -- these days Joomla, WordPress and Drupal are popular -- are written by thousands of people and while you might loose a little flexibility by using on that's ready made this is by far offset by not needing to redo everything from scratch. If you go with Drupal, you can also enjoy high quality, massively scalable etc code :)
If Your rquiremnt is portfolio, some general content pages, custom blog only, Wordpress will be simple and Better.
In PHP so many CMS available , most popular one is Joomla.

Advice on building a distributed CMS?

I'm in the process of designing a PHP-based content management system for personal use and eventually to be distributed. I know there are a lot of CMS's already out there, but I really haven't found one that meets my all of my needs and I also would like to have the learning experience. Security is a large focus, as are extensibility and ease of use. For those of you out there who have built your own CMS, what advice can you offer? What features are essential for a core? What are must have add-ons? What did you wish you knew before starting? What's the biggest potential roadblock/problem? Any and all advice is welcome.
Edit: Any advice on marketing do's and don't's would also be appreciated.
In building a few iterations of CMSs, some of the key things turned out to be:
Having a good rich text editor - end-users really don't want to do HTML. Consensus seems to be that FCKEditor is the best - there have been a couple of questions on this here recently
Allowing people to add new pages and easily create a menu/tab structure or cross-link between pages
Determining how to fit content into a template and/or allowing users to develop the templates themselves
Figuring out how (and whether) to let people paste content from Microsoft Word - converting magic quotes, emdashes and the weirdish Wordish HTML
Including a spellchecking feature (though Firefox has something built-in and iespell may do the job for IE)
Some less critical but useful capabilities are:
- Ability to dynamically create readable and SEO-friendly URLs (the StackOverflow way is not bad)
- Ability to show earlier versions of content after it's modified
- Ability to have a sandbox for content to let it be proofread or checked before release
- Handling of multiple languages and non-English/non-ASCII characters
Well, building your own CMS actually implies that it is not an enterprise-level product. What this means is that you will not be able to actually implement all features that make CMS users happy. Not even most features. I want to clarify that by CMS I actually mean a platform for creating web applications or web sites, not a blogging platform or a scaled-down version. From personal experience I can tell you the things I want most in a CMS.
1. Extensible - provide a clean and robust API so that a programmer can do most things through code, instead of using the UI
2. Easy page creation and editing - use templates, have several URLs for a single page, provide options for URL rewriting
3. Make it component-based. Allow users to add custom functionality. Make it easy for someone to add his code to do something
4. Make it SEO-friendly. This includes metadata, again URL rewriting, good sitemap, etc.
Now there are these enterprise features that I also like, but i doubt you'll have the desire to dive into their implementation from the beginning. They include workflow (an approval process for content-creation, customizable), Built-in modules for common functionality (blogs, e-commerce, news), ability to write own modules, permissions for different users, built-in syndication, etc.
After all I speak from a developer's point of view and my opinion might not be mainstream, so you have to decide on your own in the end. Just as ahockley said - you have to know why you need to build your own CMS.
If you ask 100 different CMS users about the most important thing about their CMS, you'll probably get 80+ different answers.
The biggest roadblock is probably going to be people asking you why you built a new CMS from scratch.
If you don't know the answer to that question, I'm not sure why you're going down this path.
One thing to keep in mind is that for an internet CMS, folks are going to want integration points with many of the "usual" services. Leverage existing services such as photo sharing sites, Twitter, OpenID and the like before building your own proprietary solutions.
well i wrote a CMS for personal use and released it to the biggest chorus of chirping crickets ever! no biggie, though. i did learn a lot and i encourage you to move forward. my clients use it and like it and it's holding up fine.
but if i were to start over (and i might) here's the advice i would give myself:
scrub everything everything everything entered from the user
user administration is a product differentiator. bonus points for being able to handle someone copy/pasting from WORD.
extensibility. 90% of the comments i get are from developers who want to use the cms to host "some" of the website pages but not others. or they want to embed their custom scripts into the page among the content. my next cms will be as modular as i possibly can handle.
many folks are absolutely fanatic about clean urls.
From marketing point of view:
1) Make it templateable.
2) Make CMS SEF and have SEOed URLs.
If you need to build custom functionality where your CMS is really a window to the rest of your business layers, then use something like PyroCMS or FuelCMS which are based off of CodeIgniter framework.
Developers usually get lost in the weeds with Drupal and Joomla! / Wordpress quickly become spaghetti code-laced doozies over time. Its how much you have already drank from the Kool-aid punch bowl.
I know this isn't a direct answer to what you're looking for but if you haven't looked at it yet I'd recommend checking out CMS made simple. It has much less bloat than other CMS's and is fast and efficient. It's open source so it may be a good reference point for any questions you will run into.
Just use Drupal.
Out of the box it is very light and fast. You add modules for virtually everything, so that can be daunting but it is fantastic.
Its secure (NASA and The White House use it), its modular, its open-source, it is well supported, has a reputation for clean APIs, and has hundreds of modules from SEO to Wysiwyg....

Categories