solved : “max_allowed_packet” issue in MYSQL

December 2, 2009

I came across this problem when uploading an attachment greater than 1 MB.

I am storing the uploaded file in database table having column datatype as blob.

I have solved this problem as follows:

1) open my.cnf file

in linux, it is placed /etc/my.cnf

2) add  max_allowed_paclet = 256M under [mysqld]

e.g.,

[mysqld]
max_allowed_packet=256M

You can specify whatever packet size as per your need. “M” indicates MB

3) Restart the mysql server.

Advertisements

using is_page() conditional tags in themes

November 2, 2009

How and where to use is_page() conditional tag :

1)  Login to Administrator section

2) Pages > Add New

3) Give title as “About” and publish it.

If page.php is not there in wp-content/themes/current_theme folder, than wordPress will use index.php of the current theme to display the content.

If page.php is there and we want that “About” page should have some different look than other pages, then use the following  to achieve it:

1) Create a template file named “About.php” file same as page.php file in wp-content/themes/current_theme folder

2) Do formatting as per your needs.

3) Edit the page.php file as mentioned below :

get_header(); ?>

// use is_page conditional tag to check whether template file exists for “About” page

<?php if (is_page(‘About’)) { ?>

<?php include(“About.php”); ?>   // if template file exists than include the “About.php” file
<?php } else { ?>

// Other pages will use this section for displaying the content
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(‘<p>Read the rest of this page &raquo;</p>’); ?>
<?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages:</strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
<?php } ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

IMP:

The template file name and the name used in is_page() must be same as page title mentioned in creating page in administrator section.

for e.g : if page title is “About” then

1) create template file with name About.php

2) use page title in is_page() as is_page(‘About’)

The Template File Hierarchy

November 2, 2009

WordPress uses the Query String — information contained within each link on your web site — to decide which template or set of templates will be used to display the page.
First, WordPress matches every Query String to query types — i.e. it decides what type of page (a search page, a category page, the home page etc.) is being requested.
Templates are then chosen — and web page content is generated — in the order suggested by the WordPress Template hierarchy, depending upon what templates are available in a particular WordPress Theme.

Template_Hierarchy

List of Template files in Themes

November 2, 2009
The following files have special meaning to WordPress. We can have more files apart from these files.

style.css
The main stylesheet. This must be included with your Theme, and it must contain the information header for your Theme.

Example of information header :

/*
Theme Name: My Theme
Theme URI: the-theme’s-homepage
Description: a-brief-description
Author: your-name
Author URI: your-URI
Template: use-this-to-define-a-parent-theme–optional
Version: a-number–optional
.
General comments/License Statement if any.
.
*/
index.php
The main template. If your Theme provides its own templates, index.php must be present.


comments.php

The comments template. If not present, comments.php from the “default” Theme is used.
comments-popup.php
The popup comments template. If not present, comments-popup.php from the “default” Theme is used.
home.php
The home page template.
single.php
The single post template. Used when a single post is queried. For this and all other query templates, index.php is used if the query template is not present.
page.php
The page template. Used when an individual Page is queried.
category.php
The category template. Used when a category is queried.
author.php
The author template. Used when an author is queried.
date.php
The date/time template. Used when a date or time is queried. Year, month, day, hour, minute, second.
archive.php
The archive template. Used when a category, author, or date is queried. Note that this template will be overridden by category.php, author.php, and date.php for their respective query types.
search.php
The search results template. Used when a search is performed.
404.php
The 404 Not Found template. Used when WordPress cannot find a post or page that matches the query.

IMP:
These files have a special meaning with regard to WordPress because they are used as a replacement for index.php, when available, according to the Template Hierarchy, and when the corresponding Conditional Tag (a.k.a is_*(); function) returns true. For example, if only a single post is being displayed, the is_single() function returns ‘true’, and, if there is a single.php file in the active Theme, that template is used to generate the page.

Location of themes in WordPress

November 2, 2009

/wp-content/themes/

2 core page views in WordPress

November 2, 2009

WordPress has 2 core page views :

1) Sinple post view : when the web pages displays a single post

2) Multi-post view : lists multiple posts or post summaries

3 types of files in Themes

November 2, 2009

Themes consists of follwing 3 types of files :

1) Style Sheet  files

These files controls the lokk of the site

– style.css

2) Template files

These files control the way the web page generates the information from the Database to be displayed as a web page

– index.php, header.php, sidebar.php, footer.php etc.,

3) Functions file

– optional functions can be written in function.php file

Minimum files a Theme can have are :

1) style.css

2) index.php

Top 4 PHP Frameworks

September 9, 2009

Zend Framework (http://framework.zend.com/)

Symfony (http://www.symfony-project.org/)

cakePHP (http://cakephp.org/)

CodeIgniter (http://codeigniter.com/)

Steps to integrate UPS in VirtueMart 1.1.3

July 9, 2009

Steps to create UPS account :
i) Go to http://www.ups.com
ii) If you don’t already have a Myups User ID and Password, you will need to Register to create one, by clicking on LOGIN at top right of
screen, and then click REGISTER (The username/password will be the USER ID and PASSWORD you use in the UPS VM shipper module.)
iii) Login and then put the cursor over the Blue SUPPORT Tab and click on TECHNOLOGY SUPPORT
iv) Under TOOLS and RESOURCES, click on UPS ONLINE TOOLS
v) Click on GET TOOLS
vi) Click on REGISTER in middle of screen
vii) Follow Registration screens, and you will be sent a Developer’s Key from UPS, via email in a few minutes
viii) Go back to UPS.com > Support > Technology Support > Tools & Resources/Online Tools and under returning customers click get access key.
ix) Select get XML access key
x) Enter your Developer’s Key and hit submit – your UPS access key is displayed. This is the key you need to enter into the VirtueMart ship module.

Steps to configure the UPS in Virtuemart:
i) Click on UPS shipping method
ii) UPS access code :   Enter UPS Access key
iii) UPS user id :  Enter user id used to login in UPS account
iv) UPS password : Enter password used to login UPS account
v) Ship From Zip Code :     [Note : keep this blank.]

IMP : Make sure that Products has weights


Joomla 1.5.12 Released

July 9, 2009

Joomla! 1.5.12 Released….

To download, go to http://www.joomla.org/download.html