Archive for February, 2012

Where are the database configurations in the Magento framework?

I had to migrate a Magento store last week and since I haven’t had much experience with that framework, I was at a loss with where the database configuration file was located. No matter how hard I looked there wasn’t an apparent config file named config.php or any of the sort.

I did eventually find it in a very non-conspicuous place. The configurations are listed in /app/etc/local.xml. Not exactly a descriptive name for what I was looking for. You will then want to look for this block of code in that file:

 <resources>
            <db>
                <table_prefix><![CDATA[]]></table_prefix>
            </db>
            <default_setup>
                <connection>
                    <host><![CDATA[localhost]]></host>
                    <username><![CDATA[your_db_username]]></username>
                    <password><![CDATA[your_db_password]]></password>
                    <dbname><![CDATA[your_db_name]]></dbname>
                    <active>1</active>
                </connection>
            </default_setup>
        </resources>

I need this data only to create the database on the new server. I am not sure if changing this file will actually change the configuration of the application.

How Do I Make Tabs on My Facebook Page?

Facebook fans pages that have been designed by the user stand out much more than if you just used the pages provided by Facebook. I.E Wall, Info, Friend Activity, Photos… However if you can design your own page, you can create content only viewable to those who “like” you page while promoting the “like” action to get more content. This is accomplished through Facebook applications. There are a lot of options, but one that I feel is very under rated is “Static HTML Plus”. It’s free, and they don’t make you have their logo forever imprinted upon your material for it being free.

So after you created your page, you can install the application below to start making tabs:

https://apps.facebook.com/static_html_plus/

You can get more tabs by using the following applications:

https://apps.facebook.com/static_html_two/

https://apps.facebook.com/static_html_three/

https://apps.facebook.com/static_html_four/

How to Stretch and Scale CSS Background

I’ve seen these around quite recently and I wanted to know how they did it. “It” being a div that appears to have a dynamic background image. The background would ‘crop’ and scale as needed to fill the entirety of the window.

While looking for the ‘how-to’, I stumbled across a plugin that does this exact thing. Supersized Plug-in

Mystery Solved.

Keeping Google API sessions persistent with refresh tokens

I’ve been working with Google’s Tasks API and was looking to have a way a user would only need to authenticate their account once. Google does not explain very well on how to achieve this.

With php you will need to get the api setup HERE. You then need to then setup up an authentication stream:

require_once 'src/apiClient.php';
require_once 'src/contrib/apiTasksService.php';
 
$client = new apiClient();
$tasksService = new apiTasksService($client);

On the callback of the user allowing your app to access their tasks, you will get an access token and more importantly here a refresh token.

$auth = $client->authenticate();
$token = $client->getAccessToken();
$refresh_token = $token['refresh_token'];

Save the refresh token to somewhere you are able to access it again whenever you’d like. After that we can use that token to get the users tasks at any moment.

$client->refresh_token($refresh_token);