Nathan Waters

Budding Young Entrepreneur

Archive for August, 2006

Simple PHP Isn’t So Scary After All

HTML = childs play… it’s the most basic coding for a web page, it’s easy to learn and it’s the foundation for any sort of web development. I learnt mainly by looking at the source code on various sites: just right-click, view source.

CSS = ironing… it’s something that you’d rather not do or learn, but doing it definitely makes everything look nicer/neater. You may produce/find some burn marks, but practice makes perfect. I’m still a little rusty on CSS, but I’ve just been learning by looking at what other sites do: right-click, view source and then the CSS code will either be in there or look for a bit of code in the “head” section that has “style.css” (or similar). Copy that path to the end of the domain and your browser will open up the CSS stylesheet.

PHP = public speaking… you know that learning and perhaps mastering it will produce some very cool results, but you’re scared to even learn the basics. You know everyone uses it in some form or another, but your fear gets the better of you and you push the learning aside.

I have known for a long time that just about every decent website uses PHP ranging from simple to advanced uses and integrations. But I have always put off learning it, thinking “oh, I don’t want to have to spend hours and hours trying to learn this new language when I can either use HTML or pay someone to do it”. I have a tonne of web bookmarks for php tutorials which I’ve just added in the hopes of going back later on and reading/learning it (never happened).

Well yesterday I forced myself to look into it.

I was working on the template/logo for Drop Buy which is up now, but still under development. I knew that a lot of websites have a separate header php file for the website header and one for the footer. So that you only need to make changes in the one file for it to apply to all other pages on your site. But I had thought that even this PHP coding was difficult… to the point where when I made pixTower I actually manually copied the header and footer to each and every page (yes very sad and lame lol).

….

Actually it’s easy, here’s how:

Have a search for PHP includes tutorial

In my template for Drop Buy, I only needed a header and footer (as I just included the navbar in the header). But you can “include” numerous files like a separate menu.

Soooo, what I did was:

  1. Copied all the HTML code that included the top section of the site (so everything from the starting “html” until the end of the navigation bar I have)
  2. Paste that into a new text file and save that as “header.php”
  3. Now do the same for the footer. Copy all the HTML code which includes the footer (including the final “html”) and save that in a separate text file as “footer.php”
  4. So now all that’s left is whatever content was in the middle (between the header and footer)
  5. Start a new text file and save it as “index.php”
  6. Add this code at the top: < ?php include "header.php"; ?>
  7. Then copy the middle content beneath
  8. Then add this at the bottom: < ?php include "footer.php"; ?>
  9. Save, upload to your host, done.

So now when the index.php file is loaded (i.e. when someone goes to your main page) it automatically fetches the header and footer and adds them.

You can now repeat the same process for other pages, but save the file as about.php instead of index.php for example.

To display the .php pages you need to have them on a php server. So you can either set this up on your own computer using something like Apache or if that’s too complicated (as I’ve found) you can just edit the files using FTP (so upload them to your host and edit via FTP).

….

A few other tricks:

….

Notice how the URL to my pages are www.dropbuy.com.au/about instead of www.dropbuy.com.au/about.php?

Download this file (make sure it is name “.htaccess” only) and upload it to your root directory. It’s a .htaccess file which basically tells the server to treat /about as going to /about.php.

….

Need to change the page titles dynamically?

In your header.php file replace the title tags with:

PHP1

…and change the title to what you want for your main page.

Then in each other file (e.g. about.php), add this at the top: < ?php $title = "About :: Drop Buy"; ?>

….

Want to change the link colour to tell people what page they’re on?

If you click on the “About” you will notice it goes to the About page and highlights the About page which helps notify the user as to which page they’re currently on.

Add this at the top of your header.php file:
< ?php
/* Set a value for $PHP_SELF (for v4.2+) */
if ($PHP_SELF == "") $PHP_SELF = $_SERVER["SCRIPT_NAME"];
?>

And then for each link add this code:

PHP2

Then in you CSS file add styling definition for the class .herebar, e.g:

PHP3

So what that does is it looks at what the current page is and if it is the About page then it adds the class="herebar" to the link, otherwise it adds class="contentsbar". So you just use CSS to say: highlight the text if it’s class is “herebar”.

….

Erm, damn even that simple stuff sounds pretty complicated when writing it down lol.

Hope it helps you somewhat and was understandable enough :)

Sorry about the messy display of code. For some reason WP was spitting out all sorts of random things, so I had to create images of the code.

I’ll post some updates on Drop Buy in the coming days/weeks. I have some more fun ahead of me trying to implement a blog and a few other little features.

edit: Now reading through this great tutorial. And these, ones.

Nathan Waters
PHPerifically something

Inter-Forum Rivalry At All Time High

Who would have thought that online community forums could be so cut-throat!

As you may know, I’m a common lurker and poster (username: nado) at 4 young entrepreneur forums (sorted here in alphabetical order):

But those four are by no means the only young entrepreneur focused forums on the Net. I’ve been seeing a new forum popup every single week and some other great ones that I just haven’t yet got into (either because they are new, have little post activity or just aren’t for me) include the Blogtrepreneur Forums (run by Adnan), YoungEntrepreneur.com.au (run by Chris), EntrepreneurLounge.com (run by Jamie), NetBusinessTalk.com (run by Spencer Fry), YoungCeoForum.com (run by Maurice), GoBigNetwork.com (run by Wil) and many more.

Some offer something a little different than others, some have more traffic than others, some have better moderation than others, some have better content than others and some have better members than others. But of course any community forum requires a community to grow, so there tends to be some competition to grab new members and retain them…

OK, I’m going to try and keep this as unbiased as possible and let you decide :)

I’m a mega forum-addict and so I tend to spend more time on the forum with the most post-activity, which also generally means it has more members. Currently that forum is and has been YE.com which I’ve been registered with since mid-2005 and have over 900 posts.

However YE.com has been plagued with a couple of problems such as SPAM, lack of moderation, lack of features and a diminishing sense of community where the admins/mods seem to only show up to ’solve’ an escalating forum issue. In recent months the problems have been slowly getting better, until about a week ago when this thread went live: Adsense websites for sale. Have a read through it, as it’s a long story.

Basically a guy from New Zealand (username: F360) who I chat to every now and then via instant messaging was selling a few websites he had as he had been banned from Google Adsense (which was later found to be a mistake on Google’s behalf).

Within days after this thread… F360 (501 posts), fattony (389 posts) and iGROWyourBiz (134 posts) were all banned with apparently no publicly-released reasons.

Exactly… WTF?

Daniel (aka akula) posted this thread: fattony - unban him, which is also worth a read (esp akula’s reply).

The vibe I get from Adam (one of YE.com’s admin) is that those 3 members were promoting other competing forums for young entrepreneurs and so were banned and shut-out. But you can make up your own mind from the threads :)

The point of this blog post is that a community forum only exists if there is a community. I believe that stereotypical fierce business competition cannot and should not be applied to online community forums. Admins need to be focused on enhancing a sense of community through involvement and member wants/needs rather than focusing on competing with other forums for members.

What I’m after in a young entrepreneur forum are (in order of importance):

1) a sense of community
2) helpful responses
3) intelligent members
4) admins that respond to the community’s desires

btw, I’ve been spending a lot of time on YGG after that incident. I have absolutely no influences in any direction, but having got back into the YGG forums I am yet to see a single thread which Eric or Travis (the admins) haven’t been involved in, I am yet to see a single piece of SPAM, and I’m loving the additional features.

Nathan Waters
Always Looking For a Forum High

Last weekend I took some time away from the computer to get stuck into some physical work! … OMG, yes that thing that involves movement and use of muscles other than the keyboard-typing fingers and mouse-moving wrist. (yes currently my entire body is aching)

Actually myself and a few other friends were helping a mates parents strip out their shop as they were closing down their business. They ran a electronics/hi-fi business franchise called “Leading Edge”. Tis a long story but originally they were a “Dick Smith Electronics” franchise and had built up a large amount of goodwill around the town. But DSE treated them badly so they switched over to Leading Edge.

Things were going well until a large shopping centre opened up in the middle of town and as luck would have it, a big, new DSE opened up there too within a mere 20 metres of Leading Edge which was across the street. The shopping centre has managed to soak up the traffic, killing the majority of the rest of the town.

Anyways we spent the weekend unscrewing fittings and knocking things out and carrying them away. It was actually pretty fun!

But what it made me realise again is that I hope I manage to stay away from physical, “brick & mortar” businesses for the majority of my entrepreneurial life (except maybe a service-based business). Some people obviously prefer having a physical business where you can interact with customers and don’t have to sit in front of a computer all day.

But I’ll go through the points of why I don’t like the idea of it:

  • 9-5 is hectic enough… but that is just for an employee. When you’re the employer, the business owner running everything, that time changes to a 7-7 schedule and that could include weekends as well!
  • Stock. Think of how much capital you need to first get the stock, then think of how you’re going to store it, track it, display it, price it, sell it and worst of all, what if you can’t sell it? There was a lot of stock that remained un-sold after they had a large, almost at-cost sale at Leading Edge.
  • Expansion. How many brick & mortar businesses do you see turning over millions of dollars each year? … I know there are a lot, but when you look at how many aren’t, it becomes a little saddening. To expand your business you basically need to franchise out and open up a new shop in a new location, which is a logistical issue and an expensive move. I tend to figure that when you open a shop in a town you are immediately limited in the amount of revenue and profits you can achieve from that shop. There is only a certain amount/population that might buy goods from you in that location and the only instance where people will travel 10, 20km is if they’re after something unique or if prices are cheap enough to travel the distance.
  • It’s expensive. When you look at all the overheads of offline businesses such as rent, wages and stock to name a few… it is very pricey to not only startup, but it’s pricey just to keep it running.

You take an online business and these tend not to be issues in a lot of cases. If you’re lucky you can work just a few hours per day when you want to, you can use drop-shipping services or you may not even need stock, expanding doesn’t necessarily require a large amount of money as you basically just need to market to a wider audience using your existing website and startup/running costs are very, very low.

Heck, even when you go bust the offline business bites harder than the online one. A majority of online businesses can be run with little costs, but if you do need to close-up it’s just a matter of taking down the website, sending out a mass notification mailout to your customers and perhaps selling the site/domain. If an offline business goes under, you have un-sold stock to worry about selling, you have customers you need to notify, you have lay-bys you need to fulfil, you have shop fittings and office furniture to remove, rent contracts to get out of etc etc.

So that’s my opinion… I’d love to hear yours, post a comment!

Dugg this post? Why not digg it? :)

Update: There’s also an interesting discussion on the YGG Forums following on from what I’ve said here.

Nathan Waters
“Hosting & Internet” over “Brick & Mortar”