Category Archives: PHP

Beginning Object Oriented Programming (OOP) in PHP

Interested in learning how to program objects in PHP? Well, here is somewhat good start. This is just a small post to give you a taste. To seriously get into Object Oriented Programming, there are many concepts that are in books and classes at colleges that can give you the full scope of Object Oriented Programming (OOP).

I recently did a code challenge that involved PHP and MYSQL and wanted to make my submission stand out, so I thought I should do it using OOP. I’ve always wanted to learn OOP for PHP. I have experience doing OOP in Actionscript 3, so I wasn’t starting in the dark with OOP. Anyways, from searching online and books, I compiled this class. I thought this would be a great opportunity to post my findings for anyone out there interested in moving to OOP in PHP.


Below is the class. I would have used the code format thing in WordPress, but it doesn’t seem look nice, so I decided to just post a picture.


PHP Class

Public allows that function or variable to be used outside of the class. You could use private too, which would prevent objects outside of the class to call a function or variable inside a class.

Customer is the name of the object. The six lines, 12-17, are the variables. The MyName function just displays the name of the customer, when you call that function.

To instantiate the object, you use the below code.


Developing your own custom Zen Cart theme

Throughout the past few weeks, off and on, I’ve been doing an experimental/side project developing a custom theme for the popular e-commerce script, Zen Cart. The reason I chose Zen Cart over the others is, basing from what I’ve heard from local Web Design and internet interactive marketing agency’s is that they use Zen Cart for their e-commerce sites. I’ve heard There are other good ones out there such as OsCommerce.

Customizing your own theme for Zen Cart is not the easiest task. In order to fully customize everything, you have to go into the template files and some of the base script files in order to customize everything. If you’ve downloaded Zen Cart before, you’ll know that there is quite a bit of files and can get overwhelming. Below are some tips to help ease any frustration developers may have when customizing your own theme.

Tips
Use the Developers Tool Kit in the admin section. Using this tool, will allow you to search through the files for a specific function or keyword that you are looking for.

To remove the “Powered by Zen Cart” in the footer, go to this file:
wamp/www/templateName/includes/languages/english.php

CSS is the key.

What I’ve Done So Far
I should’ve made a screenshot of a before.

Here is what I’ve done so far. I’ve customized: the search bar, search button, moved log in to the right, removed default template text & images, added categories, added one product, changed the the footer, added spacing, changed with width, and made it centered.

rt Custom Theme


Where is “get_search_form” for WordPress 3.1.2?

I found it! I was having trouble finding where the get_search_form function is for WordPress 3.1.2. On a few sites, I heard many people having trouble finding this function, so I thought I should post where it is for WordPress 3.1.2. The location is in the “wp-includes” folder. The function is located in “general-template.php,” at line 151.

Location :
www > wp-includes > general-template.php

I was looking for the function for a WordPress website that I’m making. I’m not a fan of the old classic search button and wanted to use my own custom search button instead, and in order to do that, you need to find where the form tag is being created.


2 Column Custom WordPress Website

One of things I’ve wanted to try is making my own custom WordPress theme. I thought it was be difficult to do. Making your own custom WordPress website is actually not too hard. It would only be hard if you have no experience in PHP, HTML, and CSS. The most difficult thing I had to overcome was figuring out how to make a 2 column website and allowing the content in both columns to be changed easily with the WordPress content management system. I knew how to make a 2 column website, obviously, if you saw my website, but making it edible for someone that has no coding experience at all, was the tough part.

Below are some of the things I wanted to accomplish for this test:

  • 2 Columns
  • Change content in both columns from CMS (content management system)
  • Add internal search engine
  • Add a new design
  • Customize search button

The test was a success, for the most part. I wanted to move the internal search engine to the right more. If I spent more time on the test, I probably would have figured it out, but since this was a test, I can live with the result. I was happy that I was able to add the internal search engine and have it working. Being able to add and get that internal search engine working, has gotten me thinking about using WordPress as another alternative to building websites.

 

Making Your Own Theme

First, you want to install WAMP or LAMP. Then you want to download WordPress from WordPress.org. Thirdly, you want to decompress the files and upload it to the www folder in your WAMP/LAMP folder. The fourth step is to start WAMP/LAMP. The next step is to start WAMP/LAMP and then open a browser. The sixth step is to go to this address, “http://localhost/wp-admin/.” The seventh step is to follow the installation steps. Once you have it installed copy the default theme and rename the folder something different. The ninth step is to login as ‘Admin’ and select the theme that you just created. The tenth step is to go into the files and modify the site the way you want. If you wanted to start completely from scratch, you would go into the theme that you created and rename the index.php and page.php. Then, make your own index.php and code the page yourself.

Before

Before customizing my own theme
 

After

Customizing my own wordpress theme


Follow

Get every new post delivered to your Inbox.