Skip to content

Instantly share code, notes, and snippets.

View nguyenthanhxuan's full-sized avatar
😃

Xuan Nguyen nguyenthanhxuan

😃
View GitHub Profile
@nguyenthanhxuan
nguyenthanhxuan / index.html
Created March 24, 2013 08:06
html: begin
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>the HTML template</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="header">
<div id="header_content">
(function () {
if (!Worker) //Detect IE
document.location = "http://www.whatbrowser.org/ru/browser/";
})();
<?php
require_once("PHPExcel/PHPExcel.php");
$phpExcel = new PHPExcel();
$styleArray = array(
'font' => array(
'bold' => true,
)
);
<?php
/**
* Implements hook_form_alter().
*/
function modulename_form_alter(&$form, &$form_state, $form_id) {
// You might want to filter by content type.
if ($form_id == 'ctype_node_form') {
// Add a cancel button.
$form['actions']['cancel'] = array(
<?php
/**
* Implements hook_menu_alter().
*/
function MY_MODULE_menu_alter(&$items) {
$items['user/%user_category/edit/profile']['access callback'] = FALSE;
}
/**
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
<?php
/**
* Theme_menu_tree doesn't provide any context information
* THIS SUCKS
* But you can use hook_block_view_alter to change the theme wrapper
* OUF!
*/
function MYTHEME_menu_tree(&$variables) {
<?php
/**
* @param tid
* Term ID
* @param child_count
* TRUE - Also count all nodes in child terms (if they exists) - Default
* FALSE - Count only nodes related to Term ID
*/
function term_nc($tid, $child_count = TRUE) {
$tids = array($tid);
<?php
/**
*
* function to check if a product exist in cart or not
* @param
* $product_id takes product id we are checking if exists or not as input.
* type take product id as integer or array of product ids
* @return
* return -1 if product does not exists
* returns -2 if cart if empty
<?php
/*
1. Add a product programmatically to cart.
2. Get line item id for a product in cart from product id.
3. Delete a product programmatically from cart
4. Alter product quantity in cart(add/remove).
*/