Getting Started |
System Architecture |
Choose hardhat if you want to get a website up quickly and don't want to go through a big learning curve.
Take our 15 minute challenge. If you have any experience at all with HMTL, CSS and PHP, and you have a functioning webserver, you should be able to get something installed and functioning inside of 15 minutes.
The short answer is yes.
Hardhat uses a front controller for routing, and then executes controller actions which decend from system actions. Hardhat uses Smarty for the view layer, although you can also use PHP, and it uses beans for storing data in core, with a separate database layer for accessing the database.
Yes; for the most part.
There are a couple of areas where it is not, but by far the majority of the code is Object Oriented.
PHP 5.2 or above, MySQL (if you are going to use a database), and you need access to the .htaccess file for your document root.
Hardhat also uses JQuery, some JQuery Plugins and Smarty, which are all distributed with the application. p>
Hardhat is dual licensed under the MIT License and the GNU General Public Licnese (GPL) Version 2
more info
Most websites are not truely static. There are updates to be done to keep things current. It is always better, if the updates don't need to be done by a web person. So at a minimum you are probably going to want some ajax forms and database updates.
Modify the index.php file in the root folder. The index.php file will contain some code like this:
define('DOC_ROOT', realpath(dirname(__FILE__)));
define('CONFIG_PATH', realpath('/sample_application'));
define('APPLICATION_PATH', realpath('/sample_application'));
define('SYSTEM_PATH', realpath('/hardhat_framework'));
Changeit to look more like:
define('DOC_ROOT', realpath(dirname(__FILE__)));
define('CONFIG_PATH', realpath('../sample_application'));
define('APPLICATION_PATH', realpath('../sample_application'));
define('SYSTEM_PATH', realpath('../hardhat_framework'));
and move the sample_application and hardhat_framework directories to the parent of the document root dirrectory.
Virtual hosts allow you to run many websites on your machine at once, and access them by unique names. For example, I could set up virtual hosts for my own made up domain names such as mysite.local, test.local, and dev.mysite.local. Then when I use one of these names in my browser it will serve the content from the doc root that I have specified.
So here is what you need to do. First you will need to modify your hosts file, which on a windows machine is located in something like C:\Windows\System32\drivers\etc. To edit this file, you will need to open it as an administrator. Just right click from the start menu, and choose "run as administrator". Add the following entries in the file:
127.0.0.1 mysite.local
127.0.0.1 dev.mysite.local
127.0.0.1 test.local
Now find and edit your apache/conf/httpd.conf file. You need to do two things. First, you need to allow Apache to access the directory from which you will serve your content. This is done by adding a directory entry below the one that is already there for the default document root. It should look something like:
<Directory "C:/webdev">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
The above would allow Apache to access anything in your C:/webdev directory. Next you need to add a NameVirtualHost, and entries for each virtual host you are adding. Your configuration might look something like this:
NameVirtualHost 127.0.0.1:*
<VirtualHost localhost>
ServerName localhost
DocumentRoot "C:/webdev/localhost"
</VirtualHost>
<VirtualHost mysite.local>
ServerName mysite.local
DocumentRoot "C:/webdev/mysite/prod/public"
</VirtualHost>
<VirtualHost dev.mysite.local>
ServerName dev.mysite.local
DocumentRoot "C:/webdev/mysite/dev/public"
</VirtualHost>
<VirtualHost test.local>
ServerName test.local
DocumentRoot "C:/webdev/test/public"
</VirtualHost>
Please note that the NameVirtualHost command is deprecated, but I needed it in my configuration. For more information please consult the Apache documentation at httpd.apache.org/docs
{include file="my_file.tpl" x="test"}
Note that you can pass parameters to the included template if you like.
{$object->getSomeData()}
For something like this:
assign('name',
array('firstName' => 'John',
'lastName' => 'Doe')
);
$smarty->display('index.tpl');
?>
You could access it in the template as:
First Name: {$name.firstName}
Last Name: {$name.lastName}
Use the foreach construct which is very similar to PHP.
<ul>
{$foreach $members as $member}
<li>{$member->getLastName()}, {$member->getFirstName()}</li>
{foreachelse}
<li>There were no members</li>
{/foreach}
</ul>
Vist the Smarty website at www.smarty.net.