I have a small project about a dynamic database driven website which is users can post, comment, like,... on it.
and I was thinking about creating html pages instead of php pages.
for example after someone posts sth a php code will create a html page for that post and people can comment on it. while submitting a comment, an ajax call to a php page will save comment data to database and write that comment to the html file.
I thought it could be a good way to reduce server load. and have advantages for SEO.
Does this technique have a name? and Does it have any more advantages or disadvantages?
Thanks in advance
There's a flat-file blogging engine called Kure. It's an open-source project so feel free to check it out. "Flat file system" would be the closest thing to a name for this technique.
I have to agree with my SO colleagues here. Servers and even personal computers are, for the most part, more than capable to handling what you're describing using a real database. Blogging engines such as Wordpress, are incredibly powerful and flexible and will save you a lot of hassle down the line.
That said, if you insist in creating your own flat-file system... more power to you. Good luck.
Yes, it is a known technique for optimizing serving of relatively static pages. By 'relatively static' I mean "dynamic, but update rarely".
For example, Yandex (a search engine) uses this to serve its main page. It's pretty rich page, and it would require significant resources to generate it on each request.
Also, there is (at least, there was) a plugin for Wordpress that does this.
You can't use this technique if your pages update often (it will not worth it).
You can't use this technique if your pages are personalized (that is, if you can't serve the very same page to all your visitors).
I don't know any name for this technique. I know it's already been used for some big sites in the past but I'm not sure it's still used because it's not always easy to handle and if a file is corrupted because of a script, other scripts working with the page can make it even worse.
Related
Ok, I have a website that uses no Framework or CMS because it is a simple site that just displays some text. Nothing more, nothing special for what you would need a real CMS for.
But when I want to change some text I don't want to download the file, edit it in PhpStorm and then reupload it. So I wanted to ask if there's a minimalistic framework that enables this for me without too much time effort.
I had same problem with that.
I used CutePHP.
I suggest you to browser over here
Top 10 simple CMS
Why don't you write your own CMS then as that is exactly what you are describing.
It should be a simple matter of creating a database table:
create table mypages(url VARCHAR(128),content TEXT)
You can then echo the content field as your page when needed.
SELECT content FROM mypages WHERE url='{$_SERVER['PHP_SELF']}'
Updating could be as basic as dumping the content into a textarea in a simple HTML form. Handle login with .httaccess for simplicity and Robert's your father's brother. If you have problems writing the code then just ask here!
I reckon this is an hour or two of programming at best.
I do think that time would be better spent though, if you were to learn to use Drupal instead. Drupal is free, takes about 10 minutes to install and about 6-10 hours to get your first web pages running properly. Less if you are not fussy about themes. It is easy to use and yet was good enough to power the White House site.
Better yet, it's written in PHP so its easy to follow and understand.
The real advantage of doing it this way is that though there is a very steep learning curve as for any major CMS, once you are up there, you can do so much more so much faster. You need only learn it once, after all.
I have a PHP based website, with database connections, form processing, etc, that I need to use a CMS on. I'm trying to use Joomla but after using it for 2 days and reading tutorials on it I'm getting the impression that it's designed to handle static content and that all form processing is to be handled by 3rd party extensions.
Am I getting the wrong impression? Is there a standard way to import a PHP website into a Joomla CMS?
I inherited a Joomla 1.5 site a few months ago, so I was in a similar situation to you - where to begin, with lots of questions about Joomla, its ethos, etc. What I've learnt in the meantime is:
Joomla is very heavily dependent on 3rd-party extensions. Some of these are good, some not so good - evaluation and caution is advised.
Joomla encourages the use of extensions, even for relatively static content. Whether these are full blown 'components', or 'modules', depends on quite how powerful/flexible they need to be.
The MVC architecture that underlies everything has its positives and negatives. On the plus side, if everything is done consistently, there is a good separation of concerns and - in particular - the template system offers good configurability. On the downside, very simple components/modules have an awful lot of complexity - e.g. just in terms of number of files.
Joomla is open-source ... sort of. If your familar with the open-source community, you might be a bit disappointed with Joomla, especially when it comes to 3rd-party extensions. Many of them do not embrace the open source ethos, and try to sell code and/or support so, to reiterate, choose your extensions carefully.
Writing your own extension is fairly simple, especially if you're familiar with PHP. Although the documentation isn't great, there are some gems - in particular, take a look at:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
http://docs.joomla.org/Accessing_the_database_using_JDatabase
When it comes to forms, I'm still undecided. The site I've inherited uses a third-party extension to manage them (mod_breezingforms), but it has its issues. If you have the luxury of trying out several alternatives, take it.
Run your development site in debug mode. Take a look at database queries. In my own experience, Joomla is very, very demanding on the database. For example, I have some pages that make hundreds of calls to the database with every request. Watch out for this.
At some point, you'll see itemid in the URL and wonder what on earth it is. It refers to a menu item. Menus in Joomla are a bit more general than you might think - they don't necessarily represent a 'menu' and they're quite important. For example, the built-in way to include content on a series of pages is for them to belong to the same menu item, so you might need to create 'fake' menus to house content.
Try MODx Revolution. You can insert your existing php form processors straight into Snippets with next to no modification required, or using the existing FormIt extra. Ajax is easy as pie.
Some docs to get your started:
Overview
Making Sites with MODx
Snippets
edit: apologies if it looks like I've tried to hijack this thread, somehow missed the fact the question is referring specifically to Joomla. MODx is definitely worth a look though ;)
There aren't many CMS's that can handle forms correctly (maybe only the very very generic ones, such as contact me forms, or shopping carts), but for any other purpose, you probably want to use your own PHP script to handle and process the form.
Nothing is stopping you from having a CMS on one part of the page, and your own PHP script on another.
I've once had a website with 2 different CMS's (Wordpress and Joomla), as well as some custom made pages. Slightly trickier to handle, but it's possible.
This question is very broad to answer. There are few step-by-step tutorial available on the internet for this.
From Joomla
Site Ground tutorial
If you follow this head start. You are sure to know a lot of joomla along way and convert your website to the joomla.
BUT, it is easier to build on Joomla rather than convert to it
The first trick to using Joomla effectively is to not over think things and use code that is proven so you don't have to work so hard.
Your existing content can likely be imported to Joomla just be exporting it to a CSV then importing back in to the Joomla article table.
Form handling is incredibly easy. There are dozens of form handling extensions, some of which do more than you will likely ever need. I use ChronoForms most of the time because it can be made to do basically anything once you learn how it works. I also like RSForms if you need non-tech people to be able to create forms on their own.
"Load dynamic data" in to a Joomla article is not very specific, but I'll take a stab at it. If you mean getting user submissions, then there are front end content submission options built in. If you mean loading data from another source, then you can generally use either a module or a plugin to get that data loaded either on the page or actually within the article itself.
Spend a little time getting to know how it works. Learn the difference between a component, plugin, and module and that will help you get a better grasp of what you can do. Joomla is an extensible framework, there's nothing you can't make it do and many things that are already built for you.
I would use JUMI, a Joomla component for embending your own PHP scripts. No scripts modifications are required!
I'm a student programmer for a company, and the lead developer is making a huge push to use Dreamweaver templates for our new site with vague reasoning pointing to performance benefits.
I'm not convinced…why would one use Dreamweaver templates over a PHP or a Javascript template engine? Especially since we're still using a LAMP stack for pulling in dynamic content.
So: What are the benefits of using Dreamweaver templates for our site pages, and why would one use them over PHP or Javascript?
You'd use DW templates if you were building a purely static website with no interaction beyond following links. The template will allow you to make changes to the page layout, and all your pages will be updated to reflect the changes you made. You will have to reupload every page that uses the template in question, however.
As soon as you need more interactivity than simple navigation, or need to present data that changes over time, you've gone beyond the scope of what a DW template can reasonably do. When you get to that stage, you'll need some kind of server-side scripting language (PHP, Perl, Python, something beginning with P :) )
It sounds awfully like someone in management has heard that DW has templates and has latched onto that idea without really understanding what templates really are. Whilst it can be argued that they can improve performance in certain circumstances (a non-scripted web page will consume fewer server resources to run than a PHP script, for example), they aren't really suited to maintaining big sites, especially not if said sites require more interactivity/data presentation than DW templates can offer.
Dreamweaver templates are just unusable for the dynamic site. You can't, for example, create a template to print out 10 recent news titles. You need some server-side engine for this.
JS is not the way to go too.
I have another codeigniter CMS suggestion question. Pretty much I am just looking for a CMS that allows my client to easily add in content that doesn't necessarily need to be tied into a page. I pretty much want a MYSQL database with a gui that allows the client to upload content to certain tables in the db. I don't want any themes attached to the cms as the site code will all be custom built and I would prefer to write all the db calls to pull data for specific pages. I just need a way for the client to easily upload data to a table where I can create a model to pull the data.
I have heard of FuelCMS, Ionize, and PyroCMS but all these seem like they have too much. I am looking for a pretty barebones db that has a gui and good documentation for the api's. That's all.
Thanks!
I know you wouldn't think of ExpressionEngine as "lightweight" but from the perspective that you are speaking, it is...
It allows complete control of content separate from any design's or concepts of "pages". It's power is that you define "objects" or channels that contain specific information that you then take and construct the pages around. Channels are a more user friendly concept of the MYSQL tables you're talking about.
DownsideYou get good support because it's not free, but and worth the money.
It's module development pattern is familiar if you are a codeigniter developer also.
I'm taking on a relatively small freelance project and my client would like to update several portions of their site; photo gallery, calendar list, about page, and some event links.
My gut tells me to use something like WordPress and use "Pages" for these sections, but I'm worried about my client maintaining the formatting. Especially something like calendar dates and links.
They won't be doing any blogging - this is just so they can update those sections when needed (obviously).
But then I thought, what if I just roll my own CRUD for these portions, but I'm not sure if that would be necessary for a project like this.
So what would people out there use in a situation like this? How much control does one have over the formatting of content in WordPress? I'd like not to have to teach my client on when to call certain CSS classes.
Any help is more than appreciated.
EDIT:
Any idea how the top carousel of BungoBox was made in WordPress? Or don't you think it's possible and that is done manually?
I would stick to wordpress or similar CMS system. It will be a pain-in-the-arse, to take care of formatting (WYSIWYG for client), take care of security, make the administation pages nice and functional, and so on.
You will find a LOT of information on wordpress as a cms on the web, for example see here
Have you considered any other cms system?
From the description this is a site that would consist of just a few pages that the client would want to update? if so, I'd stick with wordpress myself. There's a ton of pre-written modules and themes already out there, and there's no sense "re-inventing the wheel". Also I've found in my travels that Wordpress leads the pack in being able to manipulate content to your will of all the CMS's and the available WYSIWIG plugins they have. Remember, if they cant' get their document to look just right, guess whose getting the call, and who will be expected to fix it on your dime if you didn't specify that in your contract (you are offering maintenance as an additional feature right?)
Now if the client is looking for a more robust system, a larger site then I interpreted in your writeup, then I'd look into more of a CMS system such as Drupal or Joomla. Avoid the trap that seems to nail PHP coders that it'd be faster to do it yourself; it'd have to be a lot of custom functioanlity to start looking at building it yourself from the ground up (and even then, there's enough frameworks to help)
What about something like Drupal? Never used it personally, but I think it's built for this sort of thing, whereas WordPress is kind of tailored towards blogs.
Definatly go with wordpress, drupal is just too heavy for the job and will take you much longer to configure.
If you are worried about your client ruining design with a WYSIWYG editor, just don't give them access.. keep them on a need to know basis for their own good.
Working with wordpress will free you from maintaining security issues and many other unpredictable-at-this-point cases of reinventing the wheel.