Developing New Paths

The Mojavi Project

Archive for May, 2009

May-27-09

Mojavi 3 revisited

posted by admin

We received some additional comments about this section of the code and various code extensions such as various file extensions and what they mean to the internal code.

This method will determine what types of requests will be recognized. There are 4 choices:

* Request::GET – Indicates that this action serves only GET requests.
* Request::POST – Indicates that this action serves only POST requests.
* Request::NONE – Indicates that this action serves no requests.

You can also select both GET and POST requests by using Request::GET | Request::POST
handleError ()

Execute any post-validation error application logic.

It also returns the view through a string of the view name or the array of a module/action/view. By default, it passes View::ERROR.
initialize ($context)

You can set up the Action in the initialize() method.If you run across a file extension ASF this references various MIDI files that are available to use for your front end. This is only related too  In a later tutorial, I’ll give an example of doing this. NOTE: It is worth to note that you must handle the context in the initialize() method. You should do this by

parent::initialize($context);

You also need to return a TRUE or FALSE based on the success of the initialization. By default it is TRUE.
isSecure ()

Does the action require security? TRUE if you do, FALSE otherwise. It is FALSE by default.
validate ()

This is used to manually validate input parameters instead of using a pre-progammed validator. This will also be explain later in the tutorial on validation.
Creating Your First Action

Now that we have an overview of the Action class, we can move forward to creating our first Action. For this example, there isn’t any request to be handled so we can set up a minimal Action.

In naming an action you must use this format Actionname Action.class.php where Actionname is what you are calling this particular action. When you declare your class, it also must have the class name in the same format Actionname Action. For this example, I chose to call this FirstAction.

When creating a new action, at the very least, there has to be an execute() method, even if it does nothing. Also, since we are displaying a non-request page, we don’t need to process any request. We tell the controller this with the getRequestMethods() method, by setting the return value to Request::NONE. Finally, we also need to tell the controller what the default view is going to be. We do this by returning View::SUCCESS in getDefaultView().

Here is what my FirstAction.class.php looks like. I basically just took my BLANKAction.class.php, renamed it to FirstAction.class.php, renamed the class to FirstAction, removed the methods I didn’t need and set the remaining 3 methods to match my needs.

class FirstAction extends Action
{
/**
* Execute any application/business logic for this action.
*/
public function execute ()
{
// we don’t need any data here because this action doesn’t serve
// any request methods, so the processing skips directly to the view
}

// ————————————————————————-

/**
* Retrieve the default view to be executed when a given request is not
* served by this action.
*/
public function getDefaultView ()
{
return View::SUCCESS;
}

// ————————————————————————-

/**
* Retrieve the request methods on which this action will process
* validation and execution.
*/
public function getRequestMethods ()
{
return Request::NONE;
}

Lastly because of the audio compression and various browsers relating to a file extension ASF format you may want to check out your page in the various browsers to make sure that your files are supported.

Tags:
May-10-09

Choose your host wisely

posted by admin

In the world of online blogging you will find multiple writings about how to successfully gain new readers and improve your SEO position. There are very few blogs about some of the basic building blocks that can make or break your entire blog. One of the key foundations that any good blog needs is fast reliable webhosting. We learned this very early on as we started to build various channels and really started to learn more about the power of blogging and how to best support our sites. You can find high end servers that can run $500 a month and beyond or you can find cheap hosting for under $100 a year. The key is to understand what you need at that moment and how fast do you anticipate your site will grow.

Many bloggers will cut their teeth on some of the free services like blogger.com but come to realize that while it is a great deal the ability to scale your site and really customize your templates can be limiting. Many of the hosting companies got this ideal early and saw the explosion in blogging so they started to advertise their blog hosting capabilities such as Bluehost and even GoDaddy has gotten more into the game.We can say that we have tried a few different companies and the traffic and uptime can vary greatly between hosts. A few things to ask or explore before settling on a host are:

Can they scale up your server in the event you start getting more traffic than you had anticipated?

What do they do if there is a spike in traffic that may put a heavier load on their servers? Some will shut your account down while others will work with you to find a better solution.

What type of up time do they guarantee?

Lastly, if this is shared plan how many sites do they usually host on one server.

Keep a few of these points in mind and you will find that your blogging will be less frustrating and allow you top focus more on developing your content and customers.