March 28th, 2012
In Habari, you can actually have your publish post/page include the ability to create a post/page without having to switch in the dashboard menu. (So when you go to the publish > post or publish > page, the two boxes will pop up on that publishing page, and you can alternate between the two without leaving.)
Really simple: go to system > admin > publish, and go modify the div class publish to look like this:
Read the rest of this entry
March 27th, 2012
Using this free module for Zen Cart (Categories Center Box), I wanted to be able to automatically pick up every category I have without having to type in every single one. So, here is a very simple solution for this – I present to you, automatically load up every category you have. To incorporate, you have to modify the following file: /includes/modules/category_center_box.php. After “$top_array = array();”, you can add the following mod:
Read the rest of this entry
March 6th, 2012
This is my first introduction to Cotonti, a content management framework. Am using it for a client site. It’s a bit like Drupal, but it looks a lot easier to manage and to develop in (at least, my initial thoughts).
One thing I noticed is that they have no real easy way to update plugins from version to version (maybe later?) but here’s a quick start guide on how to do it yourself.
You will need FTP/SFTP access (or however you choose to upload the plugins). This may/may not work for all plugins, but I’ve done a couple so far, and it seems to be the general consensus on how to upgrade.
Read the rest of this entry
February 28th, 2012
Using my previous post of assigning array variables in Smarty/Pinnacle Cart, thought someone might have use for the following snippet of code. It allows you to randomly pick/access an array variable, or, when a the page refreshes, a new array variable.
Read the rest of this entry
February 27th, 2012
There’s two ways you can assign array variables that I know of, one using Smarty’s PHP tags and one without. I’ll provide both below:
Read the rest of this entry
February 16th, 2012
Using mod + counter in Smarty, you can automatically loop through all of your products, and add a “/tr” to create a new row. I learned of the “counter” option in Smarty, which lets you actually create a counter automatically rather than assigning a variable and incrementing it through the loop.
In this example, I did mod 5 so every 5 products will create a “/tr” in the table. You can change this to however many products you like. I also use thumbnails instead of full pictures, which you can also change.
Read the rest of this entry
February 15th, 2012
Simply create a block in Pinnacle Cart, and add the following code:
Read the rest of this entry
February 12th, 2012
To just copy a string every time, you can do this:
if(input) { free(input); }
input = strdup(newstr);
That will just free the old string every time, then malloc/strcpy in one call.
Shoot yourself in the foot, help you aim, and pull the trigger.
November 18th, 2011
$origdate = '11/15/2011'; //40862
$regex = "/(\d+)\/(\d+)\/(\d+)/i";
#$replace = "$3-$1-$2";
$replace = "$3$1$2";
$findate = preg_replace($regex, $replace, $origdate);
echo "$findate
";
$exceldate = convertToExcelDate($findate);
echo $exceldate."
";
echo convertExcelToNormalDate($exceldate);
function convertToExcelDate($date)
{
$stop = unixtojd(strtotime($date));
$start = gregoriantojd(1, 1, 1900);
return ($stop - $start) + 2;
}
function convertExcelToNormalDate($date)
{
$day_difference = 25568; //Day difference between 1 January 1900 to 1 January 1970
$day_to_seconds = 86400; // no. of seconds in a day
$unixtime = ($date - $day_difference) * $day_to_seconds;
return date('Y-m-d', $unixtime);
}
October 2nd, 2011
Am working on web2py (python framework) and had an issue with looping through the python code that I saved within the database. So, for anyone who has an issue, here’s how to do the loop to break apart python code – it actually is a combination of a for loop, dictionary, and if statement. (Thanks to stackoverflow.com for helping with this one!) In part 2, I’ll give you the code on how it’ll look really sexy in a table.
Read the rest of this entry