Join Easy-Forex, THE site for forex trading. Best Website for hosting
Download Forex Joe's Free Book
You Know Free Practice Trading Account,Trading Forex A currency trade is the simultaneous buying of one currency and selling of another one. The currency combination used in the trade is called a cross (for example, the euro/US dollar, or the GB pound/Japanese yen.). The most commonly traded currencies are the so-called "majors" – EURUSD, USDJPY, USDCHF and GBPUSD.

How to create Menu and Sub menu, How to use Recursion Function in Codeigniter recursive function

cat_term - holds the basic information about single terms.

CREATE TABLE `cat_term` (
  `term_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL DEFAULT '',
  `slug` varchar(200) NOT NULL DEFAULT '',
  `term_group` varchar(250) NOT NULL DEFAULT '0',
  PRIMARY KEY (`term_id`),
  UNIQUE KEY `slug` (`slug`),
  KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8


cat_term_taxonomy  - defines the taxonomy - either tag, category, or custom taxonomy

CREATE TABLE `cat_term_taxonomy` (
  `term_taxonomy_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `term_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `taxonomy` varchar(32) NOT NULL DEFAULT '',
  `description` longtext NOT NULL,
  `parent` bigint(20) unsigned NOT NULL DEFAULT '0',
  `count` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`term_taxonomy_id`),
  UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`),
  KEY `taxonomy` (`taxonomy`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8


Here is the function:

function build_tree_drop($parent_id = 0, $level = 0) {
$getJoin = mysql_query("SELECT * FROM cat_term_taxonomy INNER JOIN cat_term ON cat_term_taxonomy.term_id=cat_term.term_id WHERE parent='" . $parent_id . "'");
$getcate = '';

foreach ($getJoin as $row) {
//indent as necessary and print name
$getcate .= '<option value="' . $row->term_id . '" class="level-' . $row->parent . '">';
$getcate .= str_repeat('&nbsp;&nbsp;&nbsp;', $level) . $row->name . "\n";
$getcate .= '</option>';
//we want to see all the children that belong to this
//node… so we need to call *this* function again
$getcate .= $this->build_tree_drop($row->term_id, $level + 1);
}
return $getcate;
}

echo $this->Model->build_tree_drop($parent_id = 0, $level = 0); Result:

Related Posts by Categories



U want get it? click here | Yul Jet

Comments :

0 comments to “How to create Menu and Sub menu, How to use Recursion Function in Codeigniter recursive function”

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

 

Blogger Torturial

Visitor From...

Followers

Copyright © 2009 by Blogger Torturial , Help Blogger , Fixs Blogger, Techlogy today

Join Easy-Forex, THE site for forex trading. Best Website for hosting
Download Forex Joe's Free Book
Template by Blog Templste 4 U | Blogspot Tutorial