Tree Structure Menu with php Using Recursive


CREATE TABLE IF NOT EXISTS `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_parent` int(11) NOT NULL DEFAULT '0',
`link` varchar(255) NOT NULL,
`order` int(11) NOT NULL DEFAULT '0',
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL DEFAULT '',
`level` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=24 ;

INSERT INTO `menu` (`id`, `id_parent`, `link`, `order`, `title`, `level`) VALUES
(12, 0, '', 0, 'Office Furniture', 0),
(13, 12, '', 0, 'Chairs', 0),
(14, 12, '', 0, 'Work Tables', 0),
(15, 12, '', 0, 'Workstations', 0),
(16, 12, '', 0, 'Storage', 0),
(17, 12, '', 0, 'Conference Tables', 0),
(18, 13, '', 0, 'with spagh', 0),
(19, 13, '', 0, 'without spagh', 0),
(20, 18, '#', 0, 'Triangle', 0),
(21, 18, '#', 0, 'Sqare', 0),
(22, 19, '#', 0, 'Simple', 0),
(23, 19, '#', 0, 'Complex', 0);

PHP Code for that example

"SET NAMES utf8"));

function createsubmenu( $item )
{
global $db;
// prepare a query to get subitems of the current $item (those with parent = $item)
$subsel = $db->prepare('SELECT id, link, title, level FROM menu WHERE id_parent = :parent ORDER BY `order`');
// run the query
$subsel->execute(array('parent' => $item));
$text = '';
// fetch one row at a time, when no more rows are available $i
// will be false and while ends
while( ($i = $subsel->fetch(PDO::FETCH_OBJ)) !== false ) {
// generate code for the current $item
// will recursively call createsubmenu to add possibly existing subitems
$text .= '

  • level - 1) . '">'
    .'link) . '">' . htmlspecialchars($i->title) . ''
    . createsubmenu($i->id) . '
  • ';
    }
    // there were no items for the current call
    if( $text == '' )
    return '';
    // items were found, wrap them in an unordered list
    return '

      ' . $text . '

    ';
    }

    echo createsubmenu(0);
    ?>

    Css code IE 6 compatible Drop down menu

    From a very long time i face the problems in creating drop down menu compatible with ie6. This is older version and its default browser that installed with the windows. So always user use this browser. So designer and developer need to application should be compatible with ie6 browser. But there is lot of problem because the ie6 not support css3 or newer feature. So there is need to use javascript some extent. The code i ready which made in both css3 and the javascript. When the browser ie6 then javascript work otherwise the css3 work.

    My code below:
    ————–

    Nicer Navigation with CSS Transitions Demo

    a#trans { background: #fff; color: #aa0000; padding: 3px; -webkit-transition: all 1s linear; }
    a#trans:hover { background: #220077; color: #fff; }
    #trans-nav { list-style-type: none; height: 40px; padding: 0; margin: 0; }
    #trans-nav li { float: left; position: relative; padding: 0; line-height: 40px; background: #5a8078 url(nav-bg.png) repeat-x 0 0; }
    #trans-nav li:hover { background-position: 0 -40px; }
    #trans-nav li a { display: block; padding: 0 15px; color: #fff; text-decoration: none; }
    #trans-nav li a:hover { color: #a3f1d7; }
    #trans-nav li ul { opacity: 0; position: absolute; left: 0; width: 8em; background: #63867f; list-style-type: none; padding: 0; margin: 0; }
    #trans-nav li:hover ul { opacity: 1; }
    #trans-nav li ul li { float: none; position: static; height: 0; line-height: 0; background: none; }
    #trans-nav li:hover ul li { height: 30px; line-height: 30px; }
    #trans-nav li ul li a { background: #63867f; }
    #trans-nav li ul li a:hover { background: #5a8078; }
    #trans-nav li { -webkit-transition: all 0.2s; }
    #trans-nav li a { -webkit-transition: all 0.5s; }
    #trans-nav li ul { -webkit-transition: all 1s; }
    #trans-nav li ul li { -webkit-transition: height 0.5s; }

    #trans-nav li ul { display: none; }
    #trans-nav li:hover ul, #trans-nav li.over ul {display: block; }
    #trans-nav li ul li { height: 30px; line-height: 30px; }

    startList = function() {
    if (document.all && document.getElementById) {
    var navRoot = document.getElementById(“trans-nav”);
    for (i=0; i<navRoot.childNodes.length; i++) {
    var node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
    node.onmouseover=function() {
    this.className+=" over";
    }
    node.onmouseout=function() {
    this.className=this.className.replace(" over", "");
    }
    }
    }
    }
    }
    window.onload=startList;

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
    <html>
    <head>
    <title>Nicer Navigation with CSS Transitions Demo</title>
    <style>
    a#trans { background: #fff; color: #aa0000; padding: 3px; -webkit-transition: all 1s linear; }
    a#trans:hover { background: #220077; color: #fff; }
    #trans-nav { list-style-type: none; height: 40px; padding: 0; margin: 0; }
    #trans-nav li { float: left; position: relative; padding: 0; line-height: 40px; background: #5a8078 url(nav-bg.png) repeat-x 0 0; }
    #trans-nav li:hover { background-position: 0 -40px; }
    #trans-nav li a { display: block; padding: 0 15px; color: #fff; text-decoration: none; }
    #trans-nav li a:hover { color: #a3f1d7; }
    #trans-nav li ul { opacity: 0; position: absolute; left: 0; width: 8em; background: #63867f; list-style-type: none; padding: 0; margin: 0; }
    #trans-nav li:hover ul { opacity: 1; }
    #trans-nav li ul li { float: none; position: static; height: 0; line-height: 0; background: none; }
    #trans-nav li:hover ul li { height: 30px; line-height: 30px; }
    #trans-nav li ul li a { background: #63867f; }
    #trans-nav li ul li a:hover { background: #5a8078; }
    #trans-nav li { -webkit-transition: all 0.2s; }
    #trans-nav li a { -webkit-transition: all 0.5s; }
    #trans-nav li ul { -webkit-transition: all 1s; }
    #trans-nav li ul li { -webkit-transition: height 0.5s; }
    </style>
    <!–[if IE]>
    <style>
    #trans-nav li ul { display: none; }
    #trans-nav li:hover ul, #trans-nav li.over ul {display: block; }
    #trans-nav li ul li { height: 30px; line-height: 30px; }
    </style>
    <![endif]–>
    <!–[if lte IE 6]>
    <script type="text/javascript">
    startList = function() {
    if (document.all && document.getElementById) {
    var navRoot = document.getElementById("trans-nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
    var node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
    node.onmouseover=function() {
    this.className+=" over";
    }
    node.onmouseout=function() {
    this.className=this.className.replace(" over", "");
    }
    }
    }
    }
    }
    window.onload=startList;
    </script>
    <![endif]–>
    </head>
    <body>
    <h1>Demo Page</h1>

    <ul id="trans-nav">
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Products</a>
    <ul>
    <li><a href="#">Widgets</a></li>
    <li><a href="#">Thingamabobs</a></li>
    <li><a href="#">Doohickies</a></li>
    </ul>
    </li>
    <li><a href="#">Contact</a></li>
    </ul>
    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push([‘_setAccount’, ‘UA-499901-76’]);
    _gaq.push([‘_trackPageview’]);

    (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl&#8217; : ‘http://www&#8217;) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
    })();

    </script>
    </body>
    </html>

    —————

    Code & Demo

    Add New items in the buddy member menu

    
    <?php 
    function my_setup_nav() {
          global $bp;
    
          bp_core_new_nav_item( array( 
                'name' => __( 'Item One', 'buddypress' ), 
                'slug' => 'my-item-one', 
                'position' => 30, 
                'screen_function' => 'my_item_one_page', 
          ) );
    
          bp_core_new_nav_item( array(
                'name' => __( 'Item Two', 'buddypress' ),
                'slug' => 'my-item-two',
                'position' => 20,
                'screen_function' => 'my_item_two_template' 
          ) );
    
          // Change the order of menu items
          $bp->bp_nav['settings']['position'] = 100;
    
          // Remove a menu item
          $bp->bp_nav['activity'] = false;
    
          // Change name of menu item
          $bp->bp_nav['groups']['name'] = 'community';
    }
    
    add_action( 'bp_setup_nav', 'my_setup_nav' );
    
    
    // Load a page template for your custom item. You'll need to have an item-one-template.php and item-two-template.php in your theme root.
    function my_item_one_template() {
          bp_core_load_template( 'item-one-template' );
    }
    
    function my_item_two_template() {
          bp_core_load_template( 'Sign-Up' );
    }
    
    
    ?>
    
    
    
    

    php code for fedex shipment

    <?php

    // Copyright 2009, FedEx Corporation. All rights reserved.
    // Version 12.0.0

    require_once(‘ShipWebServiceClient-fedex-common.php’);
    include ‘../../config/config.php’;

    $idorder = htmlspecialchars($_POST[“idorder”]);
    $Weight2  = htmlspecialchars($_POST[“weight”]);
    $Length1  = htmlspecialchars($_POST[“length”]);
    $Width1   = htmlspecialchars($_POST[“width”]);
    $Height1  = htmlspecialchars($_POST[“height”]);
    $ServiceType = htmlspecialchars($_POST[“ServiceType”]);
    //Shipper Information
    $pShipperName  = htmlspecialchars($_POST[“pShipperName”]);
    $pShipperCompany  = htmlspecialchars($_POST[“pShipperCompany”]);
    $pShipperPhoneNumber  = htmlspecialchars($_POST[“pShipperPhoneNumber”]);
    $pShipperAddress  = htmlspecialchars($_POST[“pShipperAddress”]);
    $pShipperZip  = htmlspecialchars($_POST[“pShipperZip”]);
    $pShipperCity  = htmlspecialchars($_POST[“pShipperCity”]);
    $pShipperState  = htmlspecialchars($_POST[“pShipperState”]);
    $pShipperCountryCode  = htmlspecialchars($_POST[“pShipperCountryCode”]);

    if($ServiceType==”FEDEX_GROUND”)
    {
    $do_simple=1;
    }
    else if($ServiceType==”INTERNATIONAL_PRIORITY”)
    {
    $do_simple=2;
    }
    else
    {
    $do_simple=0;
    }

    //The WSDL is not included with the sample code.
    //Please include and reference in $path_to_wsdl variable.
    $path_to_wsdl = “wsdl/ShipService_v12.wsdl”;

    //define(‘SHIP_LABEL’, ‘shipexpresslabel.pdf’);  // PDF label file. Change to file-extension .pdf for creating a PDF label (e.g. shiplabel.pdf)

    $sql = “usp_userdetail_G $idorder”;
    $r = sqlsrv_query(conn,$sql) or die ( ‘Query Error’ );
    //define(‘r’,$r);

    while($row = sqlsrv_fetch_array($r))
    {
    $ToName=$row[“FName”];
    $tolastname    =$row[“LName”];
    $ToCompany=$row[“customerCompany”];
    $ToAddress1=$row[“CAddress”];
    $ToCity =$row[“City”];
    $ToState =$row[“State”];
    $ToPostalCode=$row[“Zip”];
    $ToPhone = $row[“Phone”];
    }
    //Sender Information

    define(‘shipper_Name’,$pShipperName);
    define(‘shipperCompanyName’,$pShipperCompany);
    define(‘shipperPhoneNumber’,$pShipperPhoneNumber);
    define(‘shipperAddressLine1’,$pShipperAddress);
    define(‘shipperCity’,$pShipperCity);
    define(‘shipperStateOrProvinceCode’,$pShipperState);
    define(‘shipperPostalCode’,$pShipperZip);
    define(‘shipperCountryCode’,$pShipperCountryCode);

    //Receptent information
    define(‘RecipientName’,$ToName.’ ‘.$tolastname);
    define(‘RecipientCompanyName’,$ToCompany);
    define(‘RecipientPhoneNumber’,$ToPhone);
    define(‘RecipientAddressLine1’,$ToAddress1);
    define(‘RecipientCity’,$ToCity);
    define(‘RecipientStateOrProvinceCode’,$ToState);
    define(‘RecipientPostalCode’,$ToPostalCode);
    define(‘Weight2’,$Weight2);
    define(‘Length1’,$Length1);
    define(‘Width1’,$Width1);
    define(‘Height1’,$Height1);
    define(‘InvoiceNumber’,$idorder);

    ini_set(“soap.wsdl_cache_enabled”, “0”);

    $client = new SoapClient($path_to_wsdl, array(‘trace’ => 1)); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information

    $request[‘WebAuthenticationDetail’] = array(
    ‘UserCredential’ =>array(
    ‘Key’ => getProperty(‘key’),
    ‘Password’ => getProperty(‘password’)
    )
    );
    $request[‘ClientDetail’] = array(
    ‘AccountNumber’ => getProperty(‘shipaccount’),
    ‘MeterNumber’ => getProperty(‘meter’)
    );
    $request[‘TransactionDetail’] = array(‘CustomerTransactionId’ => ‘*** Ground Domestic Shipping Request v12 using PHP ***’);
    $request[‘Version’] = array(
    ‘ServiceId’ => ‘ship’,
    ‘Major’ => ’12’,
    ‘Intermediate’ => ‘1’,
    ‘Minor’ => ‘0’
    );

    $complex= array(
    ‘ShipTimestamp’ => date(‘c’),
    ‘DropoffType’ => ‘REGULAR_PICKUP’, // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
    ‘ServiceType’ => $ServiceType,//’FEDEX_GROUND’, // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, …
    ‘PackagingType’ => ‘YOUR_PACKAGING’, // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, …
    ‘Shipper’ => addShipper(),
    ‘Recipient’ => addRecipient(),
    ‘ShippingChargesPayment’ => addShippingChargesPayment(),
    ‘LabelSpecification’ => addLabelSpecification(),
    /* Thermal Label */
    /*
    ‘LabelSpecification’ => array(
    ‘LabelFormatType’ => ‘COMMON2D’, // valid values COMMON2D, LABEL_DATA_ONLY
    ‘ImageType’ => ‘EPL2’, // valid values DPL, EPL2, PDF, ZPLII and PNG
    ‘LabelStockType’ => ‘STOCK_4X6.75_LEADING_DOC_TAB’,
    ‘LabelPrintingOrientation’ => ‘TOP_EDGE_OF_TEXT_FIRST’
    ),
    */
    ‘CustomerSpecifiedDetail’ => array(
    ‘MaskedData’=> ‘SHIPPER_ACCOUNT_NUMBER’
    ),
    ‘RateRequestTypes’ => array(‘ACCOUNT’), // valid values ACCOUNT and LIST
    ‘PackageCount’ => 1,
    ‘PackageDetail’ => ‘INDIVIDUAL_PACKAGES’,
    ‘RequestedPackageLineItems’ => array(
    ‘0’ => addPackageLineItem2()
    ), ‘SpecialServicesRequested’ => addSpecialServices()
    );

    $complex1= array(
    ‘ShipTimestamp’ => date(‘c’),
    ‘DropoffType’ => ‘REGULAR_PICKUP’, // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
    ‘ServiceType’ => $ServiceType,//’FEDEX_GROUND’, // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, …
    ‘PackagingType’ => ‘YOUR_PACKAGING’, // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, …
    ‘Shipper’ => addShipper(),
    ‘Recipient’ => addRecipient(),
    ‘ShippingChargesPayment’ => addShippingChargesPayment(),
    ‘LabelSpecification’ => addLabelSpecification(),
    /* Thermal Label */
    /*
    ‘LabelSpecification’ => array(
    ‘LabelFormatType’ => ‘COMMON2D’, // valid values COMMON2D, LABEL_DATA_ONLY
    ‘ImageType’ => ‘EPL2’, // valid values DPL, EPL2, PDF, ZPLII and PNG
    ‘LabelStockType’ => ‘STOCK_4X6.75_LEADING_DOC_TAB’,
    ‘LabelPrintingOrientation’ => ‘TOP_EDGE_OF_TEXT_FIRST’
    ),
    */
    ‘CustomerSpecifiedDetail’ => array(
    ‘MaskedData’=> ‘SHIPPER_ACCOUNT_NUMBER’
    ),
    ‘RateRequestTypes’ => array(‘ACCOUNT’), // valid values ACCOUNT and LIST
    ‘PackageCount’ => 1,
    ‘PackageDetail’ => ‘INDIVIDUAL_PACKAGES’,
    ‘RequestedPackageLineItems’ => array(
    ‘0’ => addPackageLineItem1()
    )
    );

    $complex2 =  array(
    ‘ShipTimestamp’ => date(‘c’),
    ‘DropoffType’ => ‘REGULAR_PICKUP’, // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
    ‘ServiceType’ => $ServiceType, // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, …
    ‘PackagingType’ => ‘YOUR_PACKAGING’, // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, …
    ‘Shipper’ => addShipper(),
    ‘Recipient’ => addRecipient(),
    ‘ShippingChargesPayment’ => addShippingChargesPayment(),
    ‘CustomsClearanceDetail’ => addCustomClearanceDetail(),
    ‘LabelSpecification’ => addLabelSpecification(),
    ‘CustomerSpecifiedDetail’ => array(
    ‘MaskedData’=> ‘SHIPPER_ACCOUNT_NUMBER’
    ),
    ‘RateRequestTypes’ => array(‘ACCOUNT’), // valid values ACCOUNT and LIST
    ‘PackageCount’ => 1,
    ‘RequestedPackageLineItems’ => array(
    ‘0’ => addPackageLineItem2()
    ), ‘SpecialServicesRequested’ => addSpecialServices(),
    ‘CustomerReferences’ => array(
    ‘0’ => array(
    ‘CustomerReferenceType’ => ‘CUSTOMER_REFERENCE’,
    ‘Value’ => ‘TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS’
    )
    )
    );

    if($do_simple!=1)
    {
    $request[‘RequestedShipment’]=$complex;
    }
    else if($do_simple == 2)
    {
    $request[‘RequestedShipment’]=$complex2;
    }
    else
    {
    $request[‘RequestedShipment’]=$complex1;
    }

    try
    {
    if(setEndpoint(‘changeEndpoint’))
    {
    $newLocation = $client->__setLocation(setEndpoint(‘endpoint’));
    }

    $response = $client->processShipment($request); // FedEx web service invocation

    //var_dump($response);

    $tracking_number=$response->CompletedShipmentDetail->CompletedPackageDetails->TrackingIds->TrackingNumber;

    //var_dump($response->CompletedShipmentDetail->CompletedPackageDetails);

    //var_dump($s->TrackingIds->TrackingNumber);

    //foreach($track as $m){$m;}
    //$tracking_number=$m;
    //var_dump($s->PackageRating);

    //var_dump($tmp);

    /*echo “———————–“;
    var_dump($tmp[0]->NetCharge->Amount);

    echo “<br>”;

    echo $tmp[0]->NetCharge->Amount;
    */

    //echo $amount=explode(‘”‘,substr(explode(‘NetCharge’,explode(‘[‘,substr($data,0,800))[1])[1],0,40))[8];

    //$mid_amount=explode(‘[‘,substr($amount,0,800));
    //$mid_amount1=;

    //$amount=explode(‘”‘,substr(explode(‘NetCharge’,explode(‘[‘,substr($data,0,800))[1])[1],0,40))[8];

    if ($response->HighestSeverity != ‘FAILURE’ && $response->HighestSeverity != ‘ERROR’)
    {
    printSuccess($client, $response);

    //$trackingnumber = $response->CompletedShipmentDetail->CompletedPackageDetails->TrackingIds->TrackingNumber;//Get tracking number

    if($do_simple==0)
    {

    $trackingnumber = $tracking_number;//Get tracking number
    $netshipcharge = $net_charge=$response->CompletedShipmentDetail->CompletedPackageDetails->PackageRating->PackageRateDetails[0]->NetCharge->Amount;
    }
    else
    {
    $trackingnumber = $response->CompletedShipmentDetail->CompletedPackageDetails->TrackingIds->TrackingNumber;
    $netshipcharge  =  $response->CompletedShipmentDetail->ShipmentRating->ShipmentRateDetails->TotalNetFedExCharge->Amount;
    }
    //$netshipcharge  =  $response->CompletedShipmentDetail->ShipmentRating->ShipmentRateDetails->TotalNetFedExCharge->Amount;
    //$response->CompletedShipmentDetail->ShipmentRating->ShipmentRateDetails->TotalNetFedExCharge->Amount;
    echo $trackingnumber.”<br/>”;
    //echo $netshipcharge.”<br/>”;

    define(‘SHIP_LABEL’, ‘Labels/’.$idorder.”._.”.$trackingnumber.”._.’fedexGroundshipgroundlabel.pdf’);  // PDF label file.
    define(‘SHIP_CODLABEL’, ‘Labels/’.$idorder.”._.”.$trackingnumber.”._.’fedexGroundCODgroundreturnlabel.png’);  // PDF label file.

    $sql1 = “update carthead set trackingId=” where idorder=$idorder”;

    //  echo  $sql1 = “update carthead set trackingId=’$trackingnumber’ , trackingidGenratedOn=getdate(),Weight=$Weight2,Length=$Length1,Width=$Width1,Height=$Height1,fedexShippingCharge=$netshipcharge,ServiceType=’$ServiceType’ where idorder=$idorder”;

    //$r = sqlsrv_query ( conn,$sql1 ) or die ( ‘Query Error’ );

    //echo SHIP_LABEL1;

    $fp = fopen(SHIP_CODLABEL, ‘wb’);
    fwrite($fp, $response->CompletedShipmentDetail->CompletedPackageDetails->CodReturnDetail->Label->Parts->Image); //Create COD Return PNG or PDF file
    fclose($fp);
    //echo ‘<a href=”./’.SHIP_CODLABEL.'”>’.SHIP_CODLABEL.'</a> was generated.’.Newline;

    // Create PNG or PDF label
    // Set LabelSpecification.ImageType to ‘PNG’ for generating a PNG label

    $fp = fopen(SHIP_LABEL, ‘wb’);
    fwrite($fp, ($response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
    fclose($fp);

    define(‘PICKUP_SHIP_LABEL’, ‘test/shipexpresslabel.pdf’);

    $fp = fopen(PICKUP_SHIP_LABEL, ‘wb’);
    fwrite($fp, ($response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
    fclose($fp);

    //echo ‘<a href=”./’.SHIP_LABEL.'”>’.SHIP_LABEL.'</a> was generated.’;
    //header(“Location: ../../../../../../admin/getshipboxdetail.asp?Result=shipment created&idorder=$idorder”);

    //echo “<a href=’/ship/fedex/”.SHIP_LABEL.”‘></a>”;

    }
    else
    {
    printError($client, $response);
    }

    writeToLog($client);    // Write to log file

    } catch (SoapFault $exception) {
    printFault($exception, $client);
    }

    function addShipper(){
    $shipper = array(
    ‘Contact’ => array(
    ‘PersonName’ => shipper_Name,
    ‘CompanyName’ => shipperCompanyName,
    ‘PhoneNumber’ => shipperPhoneNumber),
    ‘Address’ => array(
    ‘StreetLines’ => array(shipperAddressLine1),
    ‘City’ => shipperCity,
    ‘StateOrProvinceCode’ => shipperStateOrProvinceCode,
    ‘PostalCode’ => shipperPostalCode,
    ‘CountryCode’ => shipperCountryCode)
    );

    return $shipper;
    }
    function addRecipient(){
    $recipient = array(
    ‘Contact’ => array(
    ‘PersonName’ => RecipientName,
    ‘CompanyName’ => RecipientCompanyName,
    ‘PhoneNumber’ => RecipientPhoneNumber
    ),
    ‘Address’ => array(
    ‘StreetLines’ => array(RecipientAddressLine1),
    ‘City’ => RecipientCity,
    ‘StateOrProvinceCode’ => RecipientStateOrProvinceCode,
    ‘PostalCode’ => RecipientPostalCode,
    ‘CountryCode’ => ‘US’,
    ‘Residential’ => true
    )
    );
    return $recipient;
    }
    function addShippingChargesPayment(){
    $shippingChargesPayment = array(‘PaymentType’ => ‘SENDER’,
    ‘Payor’ => array(
    ‘ResponsibleParty’ => array(
    ‘AccountNumber’ => getProperty(‘billaccount’),
    ‘Contact’ => null,
    ‘Address’ => array(‘CountryCode’ => ‘US’))));
    return $shippingChargesPayment;
    }
    function addLabelSpecification(){
    $labelSpecification = array(
    ‘LabelFormatType’ => ‘COMMON2D’, // valid values COMMON2D, LABEL_DATA_ONLY
    ‘ImageType’ => ‘PNG’,  // valid values DPL, EPL2, PDF, ZPLII and PNG
    ‘LabelStockType’ => ‘PAPER_4X9’);
    return $labelSpecification;
    }
    function addSpecialServices(){
    $specialServices = array(
    ‘SpecialServiceTypes’ => array(‘COD’),
    ‘CodDetail’ => array(
    ‘CodCollectionAmount’ => array(‘Currency’ => ‘USD’, ‘Amount’ => 1),
    ‘CollectionType’ => ‘ANY’)// ANY, GUARANTEED_FUNDS
    );
    return $specialServices;
    }
    function addSpecialServices_ORIGINAL(){
    $specialServices = array(
    ‘SpecialServiceTypes’ => array(‘COD’),
    ‘CodDetail’ => array(
    ‘CodCollectionAmount’ => array(‘Currency’ => ‘USD’, ‘Amount’ => 150),
    ‘CollectionType’ => ‘ANY’)// ANY, GUARANTEED_FUNDS
    );
    return $specialServices;
    }

    function addCustomClearanceDetail(){
    $customerClearanceDetail = array(
    ‘DutiesPayment’ => array(
    ‘PaymentType’ => ‘SENDER’, // valid values RECIPIENT, SENDER and THIRD_PARTY
    ‘Payor’ => array(
    ‘ResponsibleParty’ => array(
    ‘AccountNumber’ => ‘510087828’,
    ‘Contact’ => ‘1234567890’,
    ‘Address’ => array(
    ‘CountryCode’ => ‘US’
    )
    )
    )
    ),
    ‘DocumentContent’ => ‘NON_DOCUMENTS’,
    ‘CustomsValue’ => array(
    ‘Currency’ => ‘USD’,
    ‘Amount’ => 100.0
    ),
    ‘Commodities’ => array(
    ‘0’ => array(
    ‘NumberOfPieces’ => 1,
    ‘Description’ => ‘Books’,
    ‘CountryOfManufacture’ => ‘US’,
    ‘Weight’ => array(
    ‘Units’ => ‘LB’,
    ‘Value’ => 1.0
    ),
    ‘Quantity’ => 4,
    ‘QuantityUnits’ => ‘EA’,
    ‘UnitPrice’ => array(
    ‘Currency’ => ‘USD’,
    ‘Amount’ => 100.000000
    ),
    ‘CustomsValue’ => array(
    ‘Currency’ => ‘USD’,
    ‘Amount’ => 400.000000
    )
    )
    ),
    ‘ExportDetail’ => array(
    ‘B13AFilingOption’ => ‘NOT_REQUIRED’
    )
    );
    return $customerClearanceDetail;
    }

    function addPackageLineItem1(){
    $packageLineItem = array(
    ‘SequenceNumber’=>1,
    ‘GroupPackageCount’=>1,
    ‘Weight’ => array(
    ‘Value’ =>Weight2,
    ‘Units’ => ‘LB’
    ),
    ‘Dimensions’ => array(
    ‘Length’ => Length1,
    ‘Width’ => Width1,
    ‘Height’ => Height1,
    ‘Units’ => ‘IN’
    ),
    ‘CustomerReferences’ => array(
    ‘0’ => array(
    ‘CustomerReferenceType’ => ‘CUSTOMER_REFERENCE’,
    ‘Value’ => ”
    ), // valid values CUSTOMER_REFERENCE, INVOICE_NUMBER, P_O_NUMBER and SHIPMENT_INTEGRITY
    ‘1’ => array(
    ‘CustomerReferenceType’ => ‘INVOICE_NUMBER’,
    ‘Value’ => InvoiceNumber
    ),
    ‘2’ => array(
    ‘CustomerReferenceType’ => ‘P_O_NUMBER’,
    ‘Value’ => RecipientPostalCode
    )
    ),
    ‘SpecialServicesRequested’ => addSpecialServices()
    );
    return $packageLineItem;
    }
    function addPackageLineItem2(){
    $packageLineItem = array(
    ‘SequenceNumber’=>1,
    ‘GroupPackageCount’=>1,
    ‘Weight’ => array(
    ‘Value’ =>Weight2,
    ‘Units’ => ‘LB’
    ),
    ‘Dimensions’ => array(
    ‘Length’ => Length1,
    ‘Width’ => Width1,
    ‘Height’ => Height1,
    ‘Units’ => ‘IN’
    ),
    ‘CustomerReferences’ => array(
    ‘0’ => array(
    ‘CustomerReferenceType’ => ‘CUSTOMER_REFERENCE’,
    ‘Value’ => ”
    ), // valid values CUSTOMER_REFERENCE, INVOICE_NUMBER, P_O_NUMBER and SHIPMENT_INTEGRITY
    ‘1’ => array(
    ‘CustomerReferenceType’ => ‘INVOICE_NUMBER’,
    ‘Value’ => InvoiceNumber
    ),
    ‘2’ => array(
    ‘CustomerReferenceType’ => ‘P_O_NUMBER’,
    ‘Value’ => RecipientPostalCode
    )
    )//,
    //’SpecialServicesRequested’ => addSpecialServices()
    );
    return $packageLineItem;
    }
    ?>

    Free web hosting provider sites list for programmer, Developer & students

    Free web hosting provider sites list  for programmer, Developer & students

    Free web hosting provider sites list for programmer, Developer & students

    Today many of the student and developer have the great efficiency to create the robust application but due to lack of resources they never broadcast our work to the world. Now today i show you different free web hosting provider sites. With the help of these sites you can create our application & after creation of the application need to test application after performing all the stages of the production now live to application for the world. So that different audience of the world can view and use your application and put our review to you. These sites provides the different programming plateforms like PHP,JSP as well as the .net. With the help of that student can enrich our experience & directly jummp to the industry. The student & developer also contribute the new application for the software industries.

    Heroku.com
    Appfog.com 
    Cloudbees.com
    Openshift.com

    WordPress custom post with custom fields

    wordpress-custom-post

    In the wordpress there need to create certain code that can create the custom post. The custom post help in custom development.
    With the help custom post you easily add the different module like portfolio, books, movie etc. The wordpress provides to you various inbuilt functions that can increase you development faster and robust. Today i show you just management of simple portfolio items. In this context i show you with custom post type you can add the custom text box also. That custom text help them to refining your post. With the help of these custom field you can filter your matter better. I just show the below code.

    <?php

    add_action(‘init’, ‘portfolio_register’);

    function portfolio_register() {

    $labels = array(
    ‘name’ => _x(‘My Portfolio’, ‘post type general name’),
    ‘singular_name’ => _x(‘Portfolio Item’, ‘post type singular name’),
    ‘add_new’ => _x(‘Add New’, ‘portfolio item’),
    ‘add_new_item’ => __(‘Add New Portfolio Item’),
    ‘edit_item’ => __(‘Edit Portfolio Item’),
    ‘new_item’ => __(‘New Portfolio Item’),
    ‘view_item’ => __(‘View Portfolio Item’),
    ‘search_items’ => __(‘Search Portfolio’),
    ‘not_found’ =>  __(‘Nothing found’),
    ‘not_found_in_trash’ => __(‘Nothing found in Trash’),
    ‘parent_item_colon’ => ”
    );

    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘query_var’ => true,
    ‘menu_icon’ => get_stylesheet_directory_uri() . ‘/article16.png’,
    ‘rewrite’ => true,
    ‘capability_type’ => ‘post’,
    ‘hierarchical’ => false,
    ‘menu_position’ => null,
    ‘supports’ => array(‘title’,’editor’,’thumbnail’)
    );

    register_post_type( ‘portfolio’ , $args );
    }

    register_taxonomy(“Skills”, array(“portfolio”), array(“hierarchical” => true, “label” => “Skills”, “singular_label” => “Skill”, “rewrite” => true));

    add_action(“admin_init”, “admin_init”);

    function admin_init()
    {
    add_meta_box(“year_completed-meta”, “Year Completed”, “year_completed”, “portfolio”, “side”, “low”);
    add_meta_box(“credits_meta”, “Design &amp; Build Credits”, “credits_meta”, “portfolio”, “normal”, “low”);
    }

    function year_completed(){
    global $post;
    $custom = get_post_custom($post->ID);
    $year_completed = $custom[“year_completed”][0];
    ?>
    <label>Year:</label>
    <input name=”year_completed” value=”<?php echo $year_completed; ?>” />
    <?php
    }

    function credits_meta() {
    global $post;
    $custom = get_post_custom($post->ID);
    $designers = $custom[“designers”][0];
    $developers = $custom[“developers”][0];
    $producers = $custom[“producers”][0];
    ?>
    <p><label>Designed By:</label><br />
    <textarea cols=”50″ rows=”5″ name=”designers”><?php echo $designers; ?></textarea></p>
    <p><label>Built By:</label><br />
    <textarea cols=”50″ rows=”5″ name=”developers”><?php echo $developers; ?></textarea></p>
    <p><label>Produced By:</label><br />
    <textarea cols=”50″ rows=”5″ name=”producers”><?php echo $producers; ?></textarea></p>
    <?php
    }

    ?>

    <?php

    //add_meta_box( $id, $title, $callback, $page, $context, $priority );

    global $post;

    $custom = get_post_custom($post->ID);

    add_action(‘save_post’, ‘save_details’);

    function save_details(){
    global $post;

    update_post_meta($post->ID, “year_completed”, $_POST[“year_completed”]);
    update_post_meta($post->ID, “designers”, $_POST[“designers”]);
    update_post_meta($post->ID, “developers”, $_POST[“developers”]);
    update_post_meta($post->ID, “producers”, $_POST[“producers”]);
    }

    add_action(“manage_posts_custom_column”,  “portfolio_custom_columns”);
    add_filter(“manage_edit-portfolio_columns”, “portfolio_edit_columns”);

    function portfolio_edit_columns($columns){
    $columns = array(
    “cb” => “<input type=’checkbox’ />”,
    “title” => “Portfolio Title”,
    “description” => “Description”,
    “year” => “Year Completed”,
    “skills” => “Skills”,
    );

    return $columns;
    }
    function portfolio_custom_columns($column){
    global $post;

    switch ($column) {
    case “description”:
    the_excerpt();
    break;
    case “year”:
    $custom = get_post_custom();
    echo $custom[“year_completed”][0];
    break;
    case “skills”:
    echo get_the_term_list($post->ID, ‘Skills’, ”, ‘, ‘,”);
    break;
    }
    }

    //’supports’ => array(‘title’, ‘editor’, ‘thumbnail’);

    add_theme_support(‘post-thumbnails’);

    register_post_type( ‘portfolio’ , $args );
    flush_rewrite_rules();

    ?>