User defined variables in included page through functions

July 23rd, 2008 by rubin

Let’s look at how can I make the variables available in a page which is included through a function. The case is : when It can’t be done through global $variable_name (coz can’t know what variable will be in the parent page).

Inside page1.php
<?php
$myVariable = ‘this is page1.php’;
$objCommon = new Common;
// other statements.
?>

Inside page2.php
<?php
/* could be page3.php, page4.php i don’t know
* and I want all variables I’ve defined inside these pages
* to be available in page1.php or the page i include through myIncluder() function
*/
$myid=’1234′;
myIncluder(”page1.php”);
echo $myVariable; // prints value of this variable in page1.php
$objCommon->objDb->setSql(”select colname from a_table where a_col = ‘$myid’”);
?>

Here’s the solution.

<?php
function myIncluder($page){
foreach($GLOBALS as $key => $prop){
$$key = $prop;
}
}
?>

Guys, plz let me know if you have a better idea.

Ref. : http://webdeveloper.com/forum/showthread.php?p=912805

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • e-mail
  • Technorati
  • Digg
  • del.icio.us
  • Facebook

image editing - photo retouching

July 15th, 2008 by Abeen

Imavista

Imavista is the professional image editing and photo retouching services providing website. There are many image editing websites online but Imavista provides different photo adjustments features, fixing of images or photo and with the quality image editing services.

Some of the photo editing services include Image isolation, Add text to photos, Red eye repair, Date removal, Image restoration, digital hand coloring, Pop art, Black and white, Panorama making, Color correction and File conversion. You can view more of the services at http://www.imavista.com/services.html

Simply check the option box that you like for your photos to be edited and then upload it. The creative designers from Imavista will be sending you with your edited image. 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • e-mail
  • Technorati
  • Digg
  • del.icio.us
  • Facebook

Call Center

July 15th, 2008 by krishna

Customers are not new, relations are as old as a buyer and a seller and so is not management.

CSR working in a call center

The concepts of Customer Relationship Management (CRM) have been there since the concept of buying and selling came into being. CRM is broad term used by companies to manage their relationships with their customer. Operational CRM is within CRM is automation or support of customer processes that include a company’s indirect sales or service representative. Call center is a kind of CRM service provider that a company operates internally or by outsourcing it.

Call centers consist of IT infrastructure with telephone and Customer Service Representative (CSR) providing information to the customer about airlines, banking, hotels, technology etc. It typically constitutes a set of resources (typically personnel, computers and telecommunication equipment), which enable the delivery of services via the telephone. The working environment of a large call center could be envisioned as an endless room with numerous open-space cubicles, in which people with earphones sit in front of computer terminals, providing tele-services to unseen customers.

Recently with the advancement of technology call center has become predecessor of new service center known as contact center. Contact center has capability and service features that every call center has, but not vice versa. Basically contact centers are extensions of the call center with multimedia capabilities. These includes the remote service center where the traditional or Internet Telephony service is enhanced by some additional multi-media customer-contact channels, commonly Interactive Voice Response (IVR) or Voice Response Unit (VRU), e-mail, fax or web interface(possibly chat). Voice Response Units (VRU) is the industrial versions of answering machines, including the possibilities of interactions. VRU helps in routing the call to callers to the appropriate CSR by identifying their service and needs or in some case the caller may not interact to CSR and they may be served with information by IVR only (note:this reduce the CSR hiring cost).Call center are centralized offices where large numbers of workers can be managed and controlled by a relatively small number of managers and support staff. They are often supported by computer technology that manages, measures and monitors the performance and activities of the workers.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • e-mail
  • Technorati
  • Digg
  • del.icio.us
  • Facebook

Ease PHP Programming

July 11th, 2008 by rubin

Flexible programming language for me is PHP regarding my programming experience. There is more than one way to achieve the same result when programming in PHP. It depends on the programmer’s problem analysis, way of coding and the dependent conditions itself.

These are all same :
$variable = $variable + 1;
$variable ++;

$variable = $variable - 1;
$variable –;

Concatenate string :
$mystring = ‘I am good,’;
$mystring .= ‘ coz i do good.’; // fast programmer style
$mystring = $mystring . ‘ coz i do good.’; // lazy way

Single and Double Quotes :

Not having proper knowledge of using single and double quotes often eats up processing time. Any time you put something in “double” quotes, you are asking PHP to check that content for a variable. Where as, if you use a variable inside single quotes will result the variable as a string itself.

$myvariable1 = “I can use this way.”;
$myvariable2 = “This phrase has a variable. $myvariable1″; // proper use of double quotes
$myvariable3 = ‘This phrase does not have a variable. No need to let php check inside this block for a variable.’;

For better performance use shorthands for condition checks :
if($mycondition == “matched”)
echo ‘This condition doesn\’t have a brases {} as this is a single line statement inside the condition block.’;
else{
$myflag = false;
echo ‘Else condition has more to do. So it has brases {}’;
}
if($mytrueCondition || !$myfalseCondition)
echo ’statement goes here’; // no need to write if($mytrueCondition == true)

function names are always lowercase
function myFunction(){} // is same with myfunction(){}

The fewer brackets you have cluttering up your code, the easier it may be to read.
foreach ($kill as $count)
echo ‘Legolas strikes again, that makes’ . $count . ‘for me!’;

Mix up conditions with HTML :
<?php if($mycondition){ ?>
<div> This is a true result block</div>
<?php }else{ ?>
<div> This is a false result block</div>
<?php } ?>

Or, use a more secure way to companion with HTML :
$myoutput = ‘<div style=”mystyle”> This is good way of implementing HTML with php</div>’;
echo $myoutput;

Swap form post values in respective form element named variables for ease :
foreach($_POST as $key => $value){
$$key = $value; // swaps form post values creating dynamic variables of form elements
}

Better coding with performance tuning and easy debugging :
$mytxt = “This is my last phrase.”;
echo “This is my first phrase.”;
echo “This is my second phrase.”;
echo “This is my third phrase.”;
echo $mytxt;

$myPhrase = ‘This is my first phrase.’
. ‘This is my second phrase.’
. ‘This is my third phrase.’
. $mytxt;
echo $myPhrase;

Normal if else syntax :
if( $color == ‘green’ ) {
echo ‘Green’;
} else {
echo ‘Not Green’;
}

The statement will do the exact but with more readably :
echo ($color == ‘pink’ ? ‘Pink’ : ‘Not Pink’);

Query database :
$sql = “SELECT
tbl1.Field1
,tbl1.Field2
,tbl2.Field1
FROM
tbl_Table1 as tbl1
tbl_Table2 as tbl2
WHERE 1 = 1
AND tbl1.ID = tbl2.ID”;
if(!empty($myid))
$sql .= ” AND tbl1.ID =$myid”;
if(!empty($myName))
$sql .= ” AND tbl2.myName = ‘$myName’”;

Key : If you have any comments or better ideas or atleast want to know more plz do share ur views with me in this blog.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • e-mail
  • Technorati
  • Digg
  • del.icio.us
  • Facebook