Jump to content

hamza

Members
  • Posts

    321
  • Joined

  • Last visited

Posts posted by hamza

  1. I have shopping cart and i have products in session variable should i send product information to UPS as like paypal.

    or what kind of work flow is there for ups.

     

    AND for shopping cart which API i suitable.

     

    Developer APIs

    Shipping/Rating

     

    Address Validation - City, State, ZIP

        Verify the city, state, and ZIP or postal code information is valid.

    Address Validation - Street Level

        Verify the street address, suite, city, state, and ZIP or postal code information is valid.

    Locator - Global

        Find a UPS location or The UPS Store nearest to you.

    Pickup

        Request a pickup for you or for one of your customers.

    Rating

        Compare delivery services and shipping rates to determine the best option for your customers.

    Shipping

        Validate addresses, compare rates, and print labels for your internal business processes.

    Time in Transit

        Compare shipping transit times of UPS services.

     

     

     

  2. Paypal sandbox IPN

    I want to know that in sandbox mode and live paypal.

    When paypal trigger iPN what it return.

     

    An IPN is when Paypal calls one of your scripts with the payment details. That part will not change whether it is live or sandbox mode. When you receive an IPN, you have to verify it with Paypal, you have to send it back to them and they tell you if it was a genuine IPN or not. When you verify it, that is where sandbox/live differs.

     

    When live you will be connecting to ssl://www.paypal.com to verify the IPN

     

    When in sandbox you will be connecting to ssl://sandbox.paypal.com to verify it.

     

    Paypal have sample code for PHP and many other languages for this, have a look through the docs.

     

    payment details???return??

     

     

  3. i want to perform paypal integration.

    i wan to send values to paypal and if values

    are validated and accepted successfully

    i want to redirect back to my website and ask from user to

    enter someother information like cradit card number...etc

    but when i send values it show the product details and

    credit card info asking from me on paypal which i dont want.

    i want to ask user to enter Ccard infor on my own website addresss.

    plz tell me how it is possible

     

     

    here is my paypal integration code.

    <form action="https://www.paypal.com/cgi-bin/webscr" method="POST">

    To pay with PayPal now please click on the PayPal icon below:

    <input type="hidden" name="cmd" value="_xclick">

    <input type="hidden" name="business" value="your@paypal.email">

    <input type="hidden" name="item_name" value="Order #{$order_id}">

    <input type="hidden" name="amount" value="{$order_amount}">

    <input type="hidden" name="currency_code" value="{$currency_iso_3}">

    <input type="image" name="submit" src="http://images.paypal.com/images/x-click-but01.gif" alt="Pay with PayPal">

     

    </form>

  4. thanks you so much all

    for your suggestion and time.

    actually when user click on product i should need

    to pass the product id as a product link

    so i can show all details of product on next page.

    i need to validation that product id fully.

    so anyone can not disterb or change.

     

  5. i want to send values to paypal and need to redirect after validate those values and want to show my own

    form with contain other information. here is my clss

    remember i want to valdition .

    and how i can get response from paypal.

     

     

    <?php
    class paypal_class {
       
       var $last_error;                 // holds the last error encountered
       
       var $ipn_log;                    // bool: log IPN results to text file?
       var $ipn_log_file;               // filename of the IPN log
       var $ipn_response;               // holds the IPN response from paypal   
       var $ipn_data = array();         // array contains the POST values for IPN
       
       var $fields = array();           // array holds the fields to submit to paypal
    
       
       function paypal_class() {
           
          // initialization constructor.  Called when class is created.
         
          $this->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
         
          $this->last_error = '';
         
          $this->ipn_log_file = 'ipn_log.txt';
          $this->ipn_log = true;
          $this->ipn_response = '';
         
          // populate $fields array with a few default values.  See the paypal
          // documentation for a list of fields and their data types. These defaul
          // values can be overwritten by the calling script.
    
          $this->add_field('rm','2');           // Return method = POST
          $this->add_field('cmd','_xclick');
         
       }
       
       function add_field($field, $value) {
         
          // adds a key=>value pair to the fields array, which is what will be
          // sent to paypal as POST variables.  If the value is already in the
          // array, it will be overwritten.
         
          $this->fields["$field"] = $value;
       }
    
       function submit_paypal_post() {
    
          // this function actually generates an entire HTML page consisting of
          // a form with hidden elements which is submitted to paypal via the
          // BODY element's onLoad attribute.  We do this so that you can validate
          // any POST vars from you custom form before submitting to paypal.  So
          // basically, you'll have your own form which is submitted to your script
          // to validate the data, which in turn calls this function to create
          // another hidden form and submit to paypal.
    
          // The user will briefly see a message on the screen that reads:
          // "Please wait, your order is being processed..." and then immediately
          // is redirected to paypal.
    
          echo "<html>\n";
          echo "<head><title>Processing Payment...</title></head>\n";
          echo "<body onLoad=\"document.form.submit();\">\n";
          echo "<center><h3>Please wait, your order is being processed...</h3></center>\n";
          echo "<form method=\"post\" name=\"form\" action=\"".$this->paypal_url."\">\n";
    
          foreach ($this->fields as $name => $value) {
             echo "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
          }
    
          echo "</form>\n";
          echo "</body></html>\n";
       
       }
       
       function validate_ipn() {
    
          // parse the paypal URL
          $url_parsed=parse_url($this->paypal_url);       
    
          // generate the post string from the _POST vars aswell as load the
          // _POST vars into an arry so we can play with them from the calling
          // script.
          $post_string = '';   
          foreach ($_POST as $field=>$value) {
             $this->ipn_data["$field"] = $value;
             $post_string .= $field.'='.urlencode($value).'&';
          }
          $post_string.="cmd=_notify-validate"; // append ipn command
    
          // open the connection to paypal
          $fp = fsockopen($url_parsed[host],"80",$err_num,$err_str,30);
          if(!$fp) {
             
             // could not open the connection.  If loggin is on, the error message
             // will be in the log.
             $this->last_error = "fsockopen error no. $errnum: $errstr";
             $this->log_ipn_results(false);       
             return false;
             
          } else {
    
             // Post the data back to paypal
             fputs($fp, "POST $url_parsed[path] HTTP/1.1\r\n");
             fputs($fp, "Host: $url_parsed[host]\r\n");
             fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
             fputs($fp, "Content-length: ".strlen($post_string)."\r\n");
             fputs($fp, "Connection: close\r\n\r\n");
             fputs($fp, $post_string . "\r\n\r\n");
    
             // loop through the response from the server and append to variable
             while(!feof($fp)) {
                $this->ipn_response .= fgets($fp, 1024);
             }
    
             fclose($fp); // close connection
    
          }
         
          if (eregi("VERIFIED",$this->ipn_response)) {
    
             // Valid IPN transaction.
             $this->log_ipn_results(true);
             return true;       
             
          } else {
    
             // Invalid IPN transaction.  Check the log for details.
             $this->last_error = 'IPN Validation Failed.';
             $this->log_ipn_results(false);   
             return false;
             
          }
         
       }
       
       function log_ipn_results($success) {
           
          if (!$this->ipn_log) return;  // is logging turned off?
         
          // Timestamp
          $text = '['.date('m/d/Y g:i A').'] - ';
         
          // Success or failure being logged?
          if ($success) $text .= "SUCCESS!\n";
          else $text .= 'FAIL: '.$this->last_error."\n";
         
          // Log the POST variables
          $text .= "IPN POST Vars from Paypal:\n";
          foreach ($this->ipn_data as $key=>$value) {
             $text .= "$key=$value, ";
          }
    
          // Log the response from the paypal server
          $text .= "\nIPN Response from Paypal Server:\n ".$this->ipn_response;
         
          // Write to log
          $fp=fopen($this->ipn_log_file,'a');
          fwrite($fp, $text . "\n\n");
    
          fclose($fp);  // close file
       }
    
       function dump_fields() {
    
          // Used for debugging, this function will output all the field/value pairs
          // that are currently defined in the instance of the class using the
          // add_field() function.
         
          echo "<h3>paypal_class->dump_fields() Output:</h3>";
          echo "<table width=\"95%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\">
                <tr>
                   <td bgcolor=\"black\"><b><font color=\"white\">Field Name</font></b></td>
                   <td bgcolor=\"black\"><b><font color=\"white\">Value</font></b></td>
                </tr>";
         
          ksort($this->fields);
          foreach ($this->fields as $key => $value) {
             echo "<tr><td>$key</td><td>".urldecode($value)." </td></tr>";
          }
    
          echo "</table><br>";
       }
    }          
    
          $p = new paypal_class;
              $p->add_field('business', 'abc@abc.com');
           
          $p->add_field('item_name', 'Paypal Test Transaction');
          $p->add_field('amount', '1.99');
              $p->submit_paypal_post();
    
    //      To process an IPN, have your IPN processing file contain:
    
              //$p = new paypal_class;
              if ($p->validate_ipn()) {
        //      ... (IPN is verified.  Details are in the ipn_data() array)
            echo var_dump(ipn_data());
              };
    
    
    ?>

  6. As far as I know, session variables are server side meaning they're completely secure, so just use $_SESSION['variable']="data"; and call it back same way:

     

    $variable = $_SESSION['variable'];

     

     

     

    if it is safe then why people encrypt it...

  7. i all most there

    but a very little check is require

    like

    sports and hockey are roots category i need span in both

    and subcateory shoud be in anchor

    # Sports

     

        * hockey

              o hocky1

              o hocky2

              o hocky3

              o hocky4

              o hockey team

     

     

     

    <?php
    function get_cat_selectlist($current_cat_id = 0) {
       mysql_connect('localhost','root','root');
       mysql_select_db('sre');
       $sql =  'SELECT cat_id, parent ,cat_name from `tblcatagory1` where parent =  '.$current_cat_id;   
      
       
       $get_options = mysql_query($sql);
       $num_options = mysql_num_rows($get_options);
       
       echo '<pre >';
       echo $sql.'--total---'.$num_options;
       
       
       
       $out = '';
       if ($num_options > 0) { // start ul tag
       
       		$i=1;
      	
          $out = "<ul>\n";
      
          while (list($cat_id, $parent, $cat_name) = mysql_fetch_row($get_options)) {
    
    	 if( $i!=$num_options) { 		 
    
             	$out .= '<li><span>'. $cat_name.'<span> </li>'."\n";  
    
    	 }else {
    
    		$out .= '<li><a href="www.google.com">'. $cat_name.'</a></li>'."\n";  
    
    	 }
    
    
    
             $out .= get_cat_selectlist($cat_id);		 
    
    	 $i++;
          }
          $out .= "</ul>\n";
       }//if greter the zero
       return $out;   
    }//function 
    echo get_cat_selectlist();
    ?>
    
    
    

  8. thanks for your attantion but i am not will to have this way.can you add flexblility of adding any tag with li and ul tags .

    like with ul span div and same as li too.

     

    something like

    ===========

    <LI>Solar Modules	
    	<UL>			
    		<LI>PV modules			
    			<UL>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_EGS.htm">Evegreen</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_REC.htm">REC</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_MIT.htm">Mitsubishi</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_SWD.htm">SolarWorld</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_SCT.htm">SCHOTT Solar</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_KYO.htm">Kyocera</A></LI>
    				<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_AEE.htm">AEE Solar</A></LI>
    			</UL>				
    		</LI>
    
    
    		<LI>Portable PV modules
    			<UL>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_GSE.htm">Global Solar</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_PFM_RU.htm">PowerFilm roll-up</A></LI>
    				<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_PFM_UF.htm">PowerFilm ultra-flexible</A></LI>
    			</UL>
    		</LI>
    
    
    	</UL>
    
    </LI>
    

  9. menu need to be compleat need check for ending ul tag and

    and proper nesting require.plz have a look

    plz compleat it i am bothering for long time

    <?php
    // $current_cat_id: the current category id number
    // $count: just a counter, call it as 0 in your function call and forget about it
    /* GET THE DROP DOWN LIST OF CATEGORIES */
    
    function get_cat_selectlist($current_cat_id, $count, $ul_tag_started) {
    
    static $option_results;
    // if there is no current category id set, start off at the top level (zero)
    if (!isset($current_cat_id)) {
    	$current_cat_id =0;
    }
    // increment the counter by 1
    $count = $count+1;
    
    mysql_connect('localhost','root','root');
    mysql_select_db('sre');
    
    
    // query the database for the sub-categories of whatever the parent category is
    $sql =  'SELECT cat_id, parent ,cat_name from `tblcatagory1` where parent =  '.$current_cat_id;	
    //	$sql .=  'order by parent asc ';
    
    $get_options = mysql_query($sql);
    $num_options = mysql_num_rows($get_options);
    
    // our category is apparently valid, so go ahead €¦
    if ($num_options > 0) {
    
    	while (list($cat_id, $parent, $cat_name) = mysql_fetch_row($get_options)) {
    
    		// ON ROOT 0 JUST ADD TAG <li>				
    		if ($current_cat_id==0 ) {					
    			  
    			$option_results[$cat_id] = '<li>'. $cat_name.'</li>';
    			// now call the function again, to recurse through the child categories
    			get_cat_selectlist($cat_id, $count ,'no');							
    		}
    
    		//same parent then JUST ADD TAG <ul> <li>				
    		if (  $current_cat_id === $parent ) {					
    
    			if ($ul_tag_started=='no') {
    
    				$option_results[$cat_id] = '<ul> <li>'. $cat_name .'</li>';								
    				// now call the function again, to recurse through the child categories							
    
    
    				get_cat_selectlist($cat_id, $count, 'yes');
    
    			}else if ($ul_tag_started=='yes') { 		//if ul tag started
    
    					$option_results[$cat_id] = '<li>'. $cat_name.'_'.$cat_id.'</li>';						
    
    
    					//now call the function again, to recurse through the child categories						
    
    
    					get_cat_selectlist($cat_id, $count , '');
    			}				
    		}
    
    	}//while fetching
    
    }//if greter the zero
    return $option_results;	
    }//function 
    
    //calling function
    $get_options = get_cat_selectlist(0, 0,'no');
    
    //print_r($get_options);
    
    
    
    echo '<ul>';
    
    foreach ($get_options as $key => $value) {
    
    	echo $value;
    }
    
    echo $options;
    
    echo '</ul>';
    
    /*
    echo '<select name="cat_id">';
    echo '<option value="">-- Select -- </option>';
    
    $get_options = get_cat_selectlist(0, 0);
    if (count($get_options) > 0){
    
    $categories = $_POST['cat_id'];
    foreach ($get_options as $key => $value) {
    
    	$options .="<option value=\"$key\"";
    
    	// show the selected items as selected in the listbox
    	if ($_POST['cat_id'] == "$key") {
    		$options .=" selected=\"selected\"";
    	}
    	$options .=">$value</option>\n";
    }
    }
    echo $options;
    echo '</select>';
    */
    ?>
    <!--
    
    /*
    MySQL Data Transfer
    Source Host: localhost
    Source Database: sre
    Target Host: localhost
    Target Database: sre
    Date: 3/17/2010 9:59:50 AM
    */
    
    SET FOREIGN_KEY_CHECKS=0;
    -- ----------------------------
    -- Table structure for tblcatagory1
    -- ----------------------------
    CREATE TABLE `tblcatagory1` (
      `cat_id` int(10) NOT NULL auto_increment,
      `parent` int(10) default NULL,
      `cat_name` varchar(255) default NULL,
      
    `cat_description` varchar(255) default NULL,
      `image` varchar(255) default NULL,
      `date_updated` datetime default NULL,
      PRIMARY KEY  (`cat_id`)
    ) 
    ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
    -- ----------------------------
    -- Records 
    -- ----------------------------
    INSERT INTO `tblcatagory1` VALUES ('1', '0', 'Sports', 'sports description', null, '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('2', '1', 'hockey', 'hockey decription', null, '2004-09-04 00:30:35');
    INSERT INTO `tblcatagory1` VALUES ('3', '1', 'football', 'football description', null, null);
    INSERT INTO `tblcatagory1` VALUES ('4', '0', 'Books', 'sdfasdf', null, '2004-09-17 00:30:38');
    INSERT INTO `tblcatagory1` VALUES ('5', '4', 'Classics', 'sdfasdf', null, '2004-09-24 00:30:40');
    INSERT INTO `tblcatagory1` VALUES ('6', '4', 'Historical', 'sadfsadfwe', null, '2004-09-30 00:30:32');
    INSERT INTO `tblcatagory1` VALUES ('7', '4', 'Horror', 'fefwefwefwef', null, '2004-09-17 00:35:35');
    INSERT INTO `tblcatagory1` VALUES ('8', '4', 'Mystery, Thriller', '<p>fwefwefv we</p>', null, '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('9', '4', 'Religious, Inspirational', 'fv wefwefwefv we', null, '2004-09-10 00:30:29');
    INSERT INTO `tblcatagory1` VALUES ('10', '7', 'Detective', 'fwefcv we fwefwef ', null, '2004-09-03 00:30:27');
    INSERT INTO `tblcatagory1` VALUES ('11', '7', 'Suspense', 'fwecf ew we wefwe e', null, '2004-09-03 00:30:46');
    INSERT INTO `tblcatagory1` VALUES ('12', '2', 'hocky1', 'jjj', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('13', '2', 'hocky2', 'a', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('14', '2', 'hocky3', 'a', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('15', '2', 'hocky4', '<p> ssssss</p>', '1096398814.jpg', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('16', '6', 'his1 book', '<p> sssssssssssssssssssssssssssss1313131313</p>', '1096398862.jpg', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('17', '6', 'his2 book', '<p> sssssssssssssssssssssssssssss1313131313</p>', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('18', '3', 'sdfsfsdffsdfs', '<h1> sdfsafsf</h1>', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('19', '8', 'MT1', '<p> aaaaaaaaaaaaaaaaaaaaaaaaa</p>', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory1` VALUES ('20', '2', 'hockey team', '<p> aaaaaaaaaaaaaaaaaaa</p>', '1096400901.jpg', '2004-09-29 00:00:00');
    -->

  10. cat

      |_subcat

            |_product1

              |_product2

      |_subcat

                |_product3

                |_product4

     

    below code is creating menu like this shown about.

    the only one thing i need to have is that

    i want to put <anchor tag when it add products during

    execution or run.

     

    like  product4 should be in anchor tag etc.

    thanks

    mysql_connect('localhost','root','root');mysql_select_db('sre');
      global $menu_array; 
      //running query
      $result = mysql_query("SELECT * FROM `tblcatagory`");  
    //fetch rows to show like tree
    
    
    
    while ( $row = mysql_fetch_assoc($result) )
    
    
    
    {
            $menu_array[$row['cat_id']] = array('Categoryid'=> $row['cat_id'],'name' => $row['cat_name'],'parent' => $row['parent']);
    
    
    
    
    
    
    }
    //recursive function that prints categories as a nested html unorderd list
    function generate_menu($parent)
    {
    
    
    
    
    
    $has_childs = false;
            //this prevents printing 'ul' if we don't have subcategories for this category      
    
    
    
    
    
    
    
    
    //make array global
    
    
    
    
    
    global $menu_array; 
    
    
    
    
    
    //use global array variable instead of a local variable to lower stack memory requierment
    
    
    
        foreach($menu_array as $key => $value)        {
    
    
    
    
    
            if ($value['parent'] == $parent) 
                    {   //if this is the first child print '<ul>'             if ($has_childs === false)                        {
                                    //don't print '<ul>' multiple times                                                             $has_childs = true;                                echo '<ul id="red" class="treevi ew-red treeview">';   }   echo '<li>  <span> ' . $value['name'].'</span>';
                            generate_menu($key);  //call function again to generate nested list for subcategories belonging to this category
                            echo '</li>';               }      }      if ($has_childs === true) echo '</ul>';} echo generate_menu(0);
    

    schema

    ======

    /*
    MySQL Data Transfer
    Source Host: localhost
    Source Database: sre
    Target Host: localhost
    Target Database: sre
    Date: 3/16/2010 2:08:56 PM
    */
    
    SET FOREIGN_KEY_CHECKS=0;
    -- ----------------------------
    -- Table structure for tblcatagory
    -- ----------------------------
    CREATE TABLE `tblcatagory` (
      `cat_id` int(10) NOT NULL AUTO_INCREMENT,
      `parent` int(10) DEFAULT NULL,
      `cat_name` varchar(255) DEFAULT NULL,
      `cat_description` varchar(255) DEFAULT NULL,
      `image` varchar(255) DEFAULT NULL,
      `date_updated` datetime DEFAULT NULL,
      PRIMARY KEY (`cat_id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
    
    -- ----------------------------
    -- Records 
    -- ----------------------------
    INSERT INTO `tblcatagory` VALUES ('1', '0', 'Sports', '<p>sports description</p>', null, '2010-03-16 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('2', '1', 'hockey', 'hockey decription', null, '2004-09-04 00:30:35');
    INSERT INTO `tblcatagory` VALUES ('3', '1', 'football', 'football description', null, null);
    INSERT INTO `tblcatagory` VALUES ('4', '0', 'Books', 'sdfasdf', null, '2004-09-17 00:30:38');
    INSERT INTO `tblcatagory` VALUES ('5', '4', 'Classics', 'sdfasdf', null, '2004-09-24 00:30:40');
    INSERT INTO `tblcatagory` VALUES ('6', '4', 'Historical', 'sadfsadfwe', null, '2004-09-30 00:30:32');
    INSERT INTO `tblcatagory` VALUES ('7', '4', 'Horror', 'fefwefwefwef', null, '2004-09-17 00:35:35');
    INSERT INTO `tblcatagory` VALUES ('8', '4', 'Mystery, Thriller', '<p>fwefwefv we</p>', null, '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('9', '4', 'Religious, Inspirational', 'fv wefwefwefv we', null, '2004-09-10 00:30:29');
    INSERT INTO `tblcatagory` VALUES ('10', '7', 'Detective', 'fwefcv we fwefwef ', null, '2004-09-03 00:30:27');
    INSERT INTO `tblcatagory` VALUES ('11', '7', 'Suspense', 'fwecf ew we wefwe e', null, '2004-09-03 00:30:46');
    INSERT INTO `tblcatagory` VALUES ('12', '2', 'jjjj', 'jjj', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('13', '2', 'a', 'a', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('14', '2', 'a', 'a', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('15', '2', 'ssssssss', '<p> ssssss</p>', '1096398814.jpg', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('16', '6', 'ssssssssss', '<p> sssssssssssssssssssssssssssss1313131313</p>', '1096398862.jpg', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('17', '6', 'ssssssssss', '<p> sssssssssssssssssssssssssssss1313131313</p>', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('18', '3', 'sdfsfsdffsdfs', '<h1> sdfsafsf</h1>', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('19', '8', 'aaaa', '<p> aaaaaaaaaaaaaaaaaaaaaaaaa</p>', '', '2004-09-29 00:00:00');
    INSERT INTO `tblcatagory` VALUES ('20', '2', 'aaa', '<p> aaaaaaaaaaaaaaaaaaa</p>', '1096400901.jpg', '2004-09-29 00:00:00');
    
    
    

     

     

  11. i have a function which is recursively creating list menu

    i only want to include classes , span tag kindly see the output

    schema is attached

    mysql_connect('localhost','root','root');mysql_select_db('sre');
      global $menu_array; 
      //running query
      $result = mysql_query("SELECT * FROM `tblcatagory`");  
    //fetch rows to show like tree
    while ( $row = mysql_fetch_assoc($result) )
    {
            $menu_array[$row['cat_id']] = array('Categoryid'=> $row['cat_id'],'name' => $row['cat_name'],'parent' => $row['parent']);	
    }
    //recursive function that prints categories as a nested html unorderd list
    function generate_menu($parent)
    {
    	$has_childs = false;
            //this prevents printing 'ul' if we don't have subcategories for this category      	
    	 //make array global
    	 global $menu_array; 
    	//use global array variable instead of a local variable to lower stack memory requierment
        foreach($menu_array as $key => $value)        {
    	        if ($value['parent'] == $parent) 
                    {   //if this is the first child print '<ul>'             if ($has_childs === false)                        {
                                    //don't print '<ul>' multiple times                                                             $has_childs = true;                                echo '<ul id="red" class="treevi ew-red treeview">';   }   echo '<li>  <span> ' . $value['name'].'</span>';
                            generate_menu($key);  //call function again to generate nested list for subcategories belonging to this category
                            echo '</li>';               }      }      if ($has_childs === true) echo '</ul>';} echo generate_menu(0);

    i need output like this ..........

    
    <UL id="red" class="treeview-red treeview">
    <LI><A href="http://www.aeesolar.com/catalog/index.html" id="ovwLink">Overview</A></LI>
    <LI class="expandable"><DIV class="hitarea  expandable-hitarea"></DIV><SPAN>Pre-Configured Systems</SPAN>
    	<UL style="display: none; ">
    		<LI><A href="./AEE Solar grid-tie PV power systems, grid-tie solar power systems_files/AEE Solar grid-tie PV power systems, grid-tie solar power systems.htm" class="selected">Grid-tie</A></LI>
    		<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_PC_GTBB.htm">Grid-tie with battery backup</A></LI>
    		<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_PC_RP.htm">Remote power</A></LI>
    	</UL>
    </LI>
    <LI class="expandable"><DIV class="hitarea expandable-hitarea"></DIV><SPAN class="">Solar Modules</SPAN>
    	<UL style="display: none; ">
    		<LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>PV modules</SPAN>
    			<UL style="display: none; ">
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_EGS.htm">Evegreen</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_REC.htm">REC</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_MIT.htm">Mitsubishi</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_SWD.htm">SolarWorld</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_SCT.htm">SCHOTT Solar</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_KYO.htm">Kyocera</A></LI>
    				<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PVM_AEE.htm">AEE Solar</A></LI>
    			</UL>
    		</LI>
    		<LI class="expandable lastExpandable"><DIV class="hitarea expandable-hitarea lastExpandable-hitarea "></DIV><SPAN>Portable PV modules</SPAN>
    			<UL style="display: none; ">
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_GSE.htm">Global Solar</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_PFM_RU.htm">PowerFilm roll-up</A></LI>
    				<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_SM_PPVM_PFM_UF.htm">PowerFilm ultra-flexible</A></LI>
    			</UL>
    		</LI>
    	</UL>
    </LI>
    <LI class="collapsable"><DIV class="hitarea  collapsable-hitarea"></DIV><SPAN class="">Mounting Structures</SPAN>
    	<UL style="display: block; ">
    		<LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>SnapNrack</SPAN>
    			<UL style="display: none; ">
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_UK.htm">Universal kits</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_SR.htm">Standard rail sets</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_RA.htm">Roof attachment pieces</A></LI>
    				<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_SNR_GM.htm">Ground mount</A></LI>
    			</UL>
    		</LI>
    		<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_QMT.htm">Quick Mount PV - waterproof flashing</A></LI>
    		<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_CRT.htm">CreoTecc tile - roof hooks</A></LI>
    		<LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>Unirac</SPAN>
    			<UL style="display: none; ">
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CMS.htm">CLICKSYS Mounting system</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_2R.htm">2-rail kits</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_4R.htm">4-rail kits</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_RB.htm">Bulk rail bundles</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_LF.htm">L-feet</A></LI>
    				<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_SBP.htm">Splice bars and plates</A></LI>
    				<LI class="expandable"><DIV class="hitarea expandable-hitarea "></DIV><SPAN>Top mounting clamp sets</SPAN>
    					<UL style="display: none; ">
    						<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CS_A.htm">Clear anodized</A></LI>
    						<LI><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CS_B.htm">Dark bronze</A></LI>
    						<LI class="last"><A href="http://www.aeesolar.com/catalog/products/H_ASW_MS_UNR_CS_LFM.htm">Lipped frame model</A></LI>
    					</UL>
    				</LI>
    
    
    

     

     

    [attachment deleted by admin]

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.