MSG Fact

FACT: Think you’re avoiding monosodium glutamate (MSG) by checking product labels? You could be wrong. Food makers now conceal MSG in packaged foods by listing it under other names, such as autolyzed or hydrolyzed vegetable protein, torula yeast, soy extracts, yeast extract, and protein isolate. So the next time you’re at a Chinese restaurant, instead of asking for “No MSG, please,” say, “No autolyzed or hydrolyzed vegetable protein, torula yeast, soy extracts, yeast extract, and protein isolate, please.” And the waiter will still nod and smile as if the MSG wasn’t already in the food and he could remove it even if he had any intention of doing so, which he doesn’t.

How to Merge/unmerge cells in PHPExcel

If you have a big piece of data you want to display in a worksheet, you can merge two or more cells together, to become one cell. This can be done using the following code:

$objPHPExcel->getActiveSheet()->mergeCells('A18:E22');

Removing a merge can be done using the unmergeCells method:

$objPHPExcel->getActiveSheet()->unmergeCells('A18:E22');

http://www.scribd.com/doc/76924448/PHPExcel-Formatting-Cells

How to format a number cell in PHPExcel

Number formats

You often want to format numbers in Excel. For example you may want a thousands separator plus a fixed number of decimals after the decimal separator. Or perhaps you want some numbers to be zero-padded. In Microsoft Office Excel you may be familiar with selecting a number format from the “Format Cells” dialog. Here there are some predefined number formats available including some for dates. The dialog is designed in a way so you don’t have to interact with the underlying raw number format code unless you need a custom number format.

In PHPExcel, you can also apply various predefined number formats.

Example:

$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1);

This will format a number e.g. 1587.2 so it shows up as 1,587.20 when you open the workbook in MS Office Excel. (Depending on settings for decimal and thousands separators in Microsoft Office Excel it may show up as 1.587,20). You can achieve exactly the same as the above by using this:

$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->setFormatCode('#,##0.00');

In Microsoft Office Excel, as well as in PHPExcel, you will have to interact with raw number format codes whenever you need some special custom number format.

Example:

$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->setFormatCode('[Blue][>=3000]$#,##0;[Red][<0]$#,##0;$#,##0');

1. Tip:

The rules for composing a number format code in Excel can be rather complicated. Sometimes you know how to create some number format in Microsoft Office Excel, but don’t know what the underlying number format code looks like. How do you find it? The readers shipped with PHPExcel come to the rescue. Load your template workbook using e.g. Excel2007 reader to reveal the number format code. Example how read a number format code forcell A1:

$objReader = PHPExcel_IOFactory::createReader('Excel2007');$objPHPExcel = $objReader->load('template.xlsx');
var_dump($objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->getFormatCode());

Advanced users may find it faster to inspect the number format code directly by renaming template.xlsx to template.zip, unzipping, and looking for the relevant piece of XML code holding the number format code inxl/styles.xml.

In my case, I need to format the cell to not show the . (dot) in a number (11.) to just (11)

This is the code:

$objPHPExcel->getActiveSheet()->getStyle($column.$style)->getNumberFormat()->setFormatCode('#');

Source:

http://www.scribd.com/doc/76924448/PHPExcel-Formatting-Cells

How to Create Pages Programmatically

https://www.google.com.ph/webhp?sourceid=chrome-instant&ie=UTF-8#hl=fil&sclient=psy-ab&q=youtube+how+to+create+a+page+in+wordpress+programmatically&oq=youtube+how+to+create+a+page+in+wordpress+programmatically&gs_l=hp.3…7271.15817.0.15981.14.10.0.0.0.3.556.1402.4-2j1.3.0…0.0.w9UzK6cIk0A&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&fp=bb6577a926407f5a&biw=1366&bih=677

http://wordpress.org/support/topic/how-to-create-pages-programmatically

global $user_ID;

$page[‘post_type’] = ‘page’;
$page[‘post_content’] = ‘Put your page content here’;
$page[‘post_parent’] = 0;
$page[‘post_author’] = $user_ID;
$page[‘post_status’] = ‘publish’;
$page[‘post_title’] = ‘Your Page Title’;
$page = apply_filters(‘yourplugin_add_new_page’, $page, ‘teams’);
$pageid = wp_insert_post ($page);
if ($pageid == 0) { /* Add Page Failed */ }

Lesson I Learned From Using WordPress

Before you install a plugin, make sure to make a database backup first. I experienced installing wp-ecommerce into my local website and after, I decided that I don’t need this to my project, so I deactivate it. I noticed that my products page is changed. I know that it is because of the wp-ecommerce plugin. I don’t know what comes to my mind that I delete the plugin from the plugins page. A notification message shows saying that wp-ecommerce is failed uninstalling or not successful. I tried to delete the wp-ecommerce plugin’s folder, but still can’t delete it. And then I restart my PC and I now successfully deleted the plugin’s folder. When I tried to go to my login’s page, I noticed that, I’m always redirected to my homepage, weird! And then, I browse some of my page, to my surprise, all of my page is redirecting me to my homepage. I tried to look in the database to see if my pages is still in it. When I browse to wp_posts, all of my page is gone. Disaster! I don’t have any backup. I searched for any solution in the internet and found out that the plugin that I installed is the latest release and it cause many website to ruin their database also. And as for now, there are no solution to this problem. So next time you will install any kind of plugin, please make sure you do a database backup.