Posts Tagged “help”

Ok, so here we are again. If you have not read the first article then you might et a little lost so its best to read that article first.

So now we have put our plan together. and we have a basic idea of what we want and what those things should do.

So we now need to make a few decisions - we asked some of these questions in part one, but now its time to make your final decision.

  1. How are we going to set this up? - When i mean how are we going to set this up i mean, will we be doing this entire program raw or are there classes or functions or maybe part full scripts we can use to help achieve what we want.
  2. Will we be using a templating system such as smarty?
  3. What other languages will you be using?

Ok so those three questions are crucial. The very first step I do after this is I open Microsoft word and save it as “My Site - Database Breakdown ” and then open another new document and save it as “My site - Functions and classes breakdown”

These two files I will be using, printing, referencing, scribbling and printing some more through the entire stage. I do this for a couple of reasons

1. I can easily track what functions I have made and what variables are required for those functions

2. I also do this, because I can then well document this software once Im done. all the hard work has already been done.

The database breakdown looks a little something like this:

user_tbl {

  • userid
  • username
  • password (md5)<– I add notes in brackets)
  • email (strlower)
  • level (the level of authorization this user has)
  • fname (first name)
  • lname (last name)
  • valid (if not verified, should have validation code)

Ok so above you can see a basic break down of what one of my tables in my database will have. Those are the field names and any notes I made. I do this for all the databases i think i will need before I create the databases. This helps save time, because otherwise I have to keep going back and editing the table structure.

I also print my document, so I can see what the table fields are and easily implement it to my code.

The functions and classes breakdown document that i create looks a little like this:

user_funcs.php

loginuser($username, $password); - //This  logins the user and created

logoutuser(); // Unsets all sessions for this user

getuserid($username); //gets the userid for the user in this session, so i can use it with other functions such as the one below.

getemail($userid);

So basically this is where i add the classes and functions i create for my script and I print them so i have them at hand. Obviously when I am starting a script I dont know all the functions I am going to create , so both these files will be continually edited and more info will added to them while developing.

But when I am starting a script and I have a basic idea of what I need, there are certain functions I create such as:

  • We need to connect to a database so - dbconnect($dbhost,$dbun, $dbpass);
  • We need to select a database so - dbselect($dbname);
  • If I am using user interaction I need them to register, login, etc so  register($username, $password, $email, $ip); or chkuser($username, $email);

So those functions you know you are going to use can go straight into your document.  You may even have a library of already set functions like i do, that you can incorporate into your files.

Now when i started this article I asked you those three questions, because this is the stage i begin to create folders and some php files.

I know I know…  I can hear you all screaming “Finally a php file”.  Yes I know you are all eager to get to the actual scripting.

Well I create my folders in my local server. (By the when I create my sofgtware I do it all on a local server on my computer so I can test and check for errors and make sure it is all functional before uploading to a remote server. A great little server software is Xampp it has Apache, mysql, etc supports php, pear etc - But make sure you update it often so you can keep up with your remote server software. Also keep in mind that Xampp does have features missing and Cant do everything your remote server does. Also if the Php.ini is different from the remote and local you are going to have different effects, problems etc)

My usual folder system goes something like :

  • Local server>>
    • css
    • images
    • js
    • include
    • template

Ok those are my basic folders. It will get more complex as you progress on your script.

So a quick run through :

CSS: Well obviously my style sheets go in there.

Images: Well another obvious one. my Images go in there.  If dealing with many images try and add sub folders such as Images> Nav;    Images>banners;    images>template;

JS: I tend to use Jquery quite a bit, I love the effects and applications you can create with it. So all my jquery and js files go in there.

Include: Files such as functions, classes i tend to put in there.  But i structure them in a way that is less confusing. eg:

include>classes; or include>lib; include>configs; or include>settings;

Template: Here is where I place my template folders. I love using template folders, because often I like to change one part of the template and I dont wish to do it over and over and over .But again i put my little sub folder system into play there as well, such as:

template > forms;

Now this will change if you are using smarty. Generally with smarty you put it all in one template folder or you can divide your template folder depending on themes eg: template>silverbluetheme; or template>yellowandblacktheme;

Smarty also has a great caching system, so if you are using smarty you will also need to create template_c folder in your root(local server folder).

I know this all sounds complex if you are starting out, but if you are going to learn you should try and learn all the good habits of developing and not learn the unorganized way and go file hunting when you are looking for something.

Before we go on to php, Make sure you protect those folders from robots and prying eyes. I will explain a little more below.

Ok now to the PHP:

The files I generally create with any software is : (if highlighted in red, it means it is a name of the folder.)

  • config.php or settings.php
  • globals.php
  • css/index.php - //This will stop people being able to access your css root and seeing files in that folder
  • js/index.php - //This will stop people being able to access your js root and seeing files in that folder
  • images/index.php - //This will stop people being able to access your images root and seeing files in that folder
  • template/index.php - //This will stop people being able to access your template root and seeing files in that folder
  • include/index.php - //This will stop people being able to access your incude root and seeing files in that folder
  • include/chk.php or include/foo.php or include/whatever.php // This is a file I create to check whether this person is trying to access this file directly or is it being included . If it is being access directly it will give them an error.
  • index.php
  • .htaccess //Set permissions for directories and set error pages that will be created later. Also tell the root that my default file is index.php in most cases this wont be neccesary but I have come accross some servers that have default.php or home.php as their default.
  • robots.txt // Deny robots from certain directories such as your, css, js, images, include, template folders

Ok so there are a few files that I can create immediately, Because with any project I know I am going to require those folders.

In the next article I will discuss a templating system I have created that does not use smarty.

Please share any of the systems or file structures you use, Id love to see what other developers do.

Well thanks and till next time >> Smile a while :)

Comments 1 Comment »

I have decided to begin transporting my books and stories ive been writing to my blog.

Soon i hope to create one of my stories its very own blog and move everything there.But until that day, my stories will have to live here.

Anyway,  I am looking for ideas and anyone with an interest in assisting me with some rough drawings to help me finish one of the stories in particular.

I will be adding more to the story as time allows, but until then enjoy what I have placed up on the pages.

The story I am most excited about is the Witches Nursery.

I know the story isnt finished and it is still very rough, but I will keep perfecting it.

I have this image of what I want for the book, even how the outside of the book looks like. But I could really use some insight, opinions, criticism (be gentle), ideas, praise (always love those). Images and ideas for images would be great. You can also see some of the ones I have already done.

Anyway the stories are on the top links (look up) and there are drop down links to all the sub pages.

Enjoy,

Sky :)

Comments No Comments »

As i was doing my usual daily blog rounds, i found this site that was linked to one of the blogs (for the life of me i cant remember which blog it was.. but thank you thank you for putting that link up).

Its a great site where you just answer a question and for each answer you get right, they will donate 20 grams of rice through the UN world food program to help end hunger.

The site is called FREE RICE and it is so simple that even my kids were doing it.

You huve dozens of subjects to pick from, and you can easily spend the whole day answering those questions and testing your skills. At the same time on the side of the site, it will show you how much rice you have donated and the difference you have made.

So here is the link to the site, its great, please do spare 2 minutes to visit the website, and even if you just answer one question right, that question is worth 20 grams of rice!! which can make a huge difference to the total of rice that gets sent over.

Go ahead get over there now..

Comments No Comments »

Hey everyone, I’m like putting a real quick note out here just to let you know whats happening on the rez at Pine ridge and Cheyenne river.

Its crazy weather and we have a huge amount of people and families suffering. we have over 40, 000 people out here on this rez, and most of them don’t have proper heating. Many use propane and that has become to expensive for most families.

There are families out there with young ones and elders that have no heating, elders and kids are getting sick cause they just can’t keep warm.

They way the economy is at the moment, $120 dollars only buys enough propane to warm an average home for a week.

According to the tribal energy office, they are saying that the best way to beat this, and the safest, is to use electric heaters. Which brings us to another problem, most families can’t afford those or the utility bill that comes with it.

Just $50 dollars will provide a family with an electric heater.

native Progress is trying to help provide families with 500 electric heaters, but your help is needed.We need those like yesterday, but the funds are not there.

Any donations made NOW can help a family who is desperate need, quickly!

The other option is to use the wood program.

The wood program can provide fuel for heat, for  families who need it. It will also give much needed employment to families who have no other work available.

We are supporting a wood program on Pine Ridge. The Lakota people are cutting and delivering 200 loads of cottonwood, elm and ash wood. The cost of the manpower and tools to acquire the wood and get it to the reservation will be $10,000 or $50 per cord.

You can help by donating, or by simply advertising here on Native Blogs. All advertising revenue will be directly sent to Nativeprogress donation drive.

You can help in other ways to, there is an ebay store that has been set up for the cause. They are selling crafts and posters and much more in a bid to raise money for these programs.

You can also donate items to give to families and elders such as food and winter supplies or you can donate items to sell on ebay stores.

which ever way you donate, just remember if we get together we can really make a difference to people suffering this harsh and cold winter. Just think of the children and elders battling below 0 degrees while your warm in your bed and ask your self, can you honestly sit there knowing that there are people getting sick and suffering from this winter, when you know you can make a difference.

If you want to help, then contact James at:
<!–
var prefix = ‘ma’ + ‘il’ + ‘to’;
var path = ‘hr’ + ‘ef’ + ‘=’;
var addy56726 = ‘jhorns’ + ‘@’ + ‘nativeprogress’ + ‘.’ + ‘org’;
document.write( ‘<a ‘ + path + ‘\” + prefix + ‘:’ + addy56726 + ‘\’>’ );
document.write( addy56726 );
document.write( ‘<\/a>’ );
//–>
jhorns@nativeprogress.org

Telephone: 708-903-4150.

How To Donate:

Donate Online:
Donate with PayPal

Donate By Mail:
Donations may be made by check or money order to ONE/ONE Spirit and sent to:

ONE Spirit
P.O. Box 2595
Chesterfield, VA 23832

other ways to contribute …

Comments No Comments »

Native Vibes is looking for other fellow Natives to jump aboard the Native Vibes Train and help create and design this original concept to its largest scale.

This is a Volunteer Position, but All directors will receive percentage of profits when profits are gained.

To apply for this position, head over to the form, tell us about yourself and your ideas.

You do not need any formal training, just a basic knowledge of Internet and an adequate amount of knowledge regarding Indigenous and Native peoples.

Thank you in advanced.

Apply Online

Comments No Comments »

Nativelandz - Red Nation People - Red Motion - Cultural Hoops - Native Vibes - Made to Measure Designs - Native Friends Network - Web Rez - CIA - Crafters Marker (Coming Soon)