So you’re hooked, right? You like the idea of seperating out your database interactions from your code and your code from your output. That’s cool. Now let me show you how to write your very first Snappad project.
What You Need
- A Web Server with PHP support. If you run Windows, I would suggest downloading and installing WAMP.
- Mod_Rewrite installed for Apache.
- The latest Snappad Release from our Download Center.
Let’s Roll
Now that you have Apache installed and configured, extra the Snappad archive into your Web Servers root directory. Open the snappad folder and you should see a few folders. I’ll explain what they all do.
- config - This folder contains the configuration files for custom configuring Snappad. We’ll get to that later.
- controllers - This folder contains all of the controllers. These are the files used to gather data and generate the content that will be presented in the view.
- main - This folder contains Snappad’s main architecture
- models - This folder holds models. These are basically files which control your access to data, as well as interpret the rules with how the data may be manipulated.
- modules - This folder holds different modules for added functionality.
- views - This folder holds the template files which transform the data from the controllers into viewable information.
Great! Now that you at least recognize the file structure, we can start working with the system. Open the controllers folder and create a file called home.inc.php. Now open that file insert the following lines:
<? $snappad->title = 'Welcome to My Program!!'; $content='Wow! This is Exciting!'; ?>
Now, open the views folder and insert the following lines:
<html> <head> <title><?=$snappad->title?></title> </head> <body> <h1><?=$content?></h1> </body> </html>
Now, visit http://localhost/snappad/ in your web browser and voilà! You are now staring into the face of your first Snappad program. Congratulations!
For those of you whom are somewhat experienced with PHP and programming already, I recommend looking through the Wiki, or reading some more Tutorials. For the rest of you, I would suggest reading some PHP Tutorials before jumping too much further into Snappad.
