About Us
|
Login
User Guide
Q & A
Packages
Changelog
Chat Room
Home
»
Packages
» Pod Categories
Pod Categories
Version
1.0.1
added 4 months ago by
sc0ttkclark
{"meta":{"version":"183","build":"1267939971"},"pods":{"47":{"name":"category","label":"","is_toplevel":"0","detail_page":"","list_filters":null,"pre_save_helpers":"","pre_drop_helpers":"","post_save_helpers":"","post_drop_helpers":"","fields":[{"name":"name","label":"Name","display_helper":null,"input_helper":null,"comment":"","coltype":"txt","pickval":null,"pick_filter":null,"pick_orderby":null,"sister_field_id":null,"required":"1","unique":"0","multiple":"0","weight":"0"},{"name":"slug","label":"Permalink","display_helper":null,"input_helper":null,"comment":"Leave blank to auto-generate","coltype":"slug","pickval":null,"pick_filter":null,"pick_orderby":null,"sister_field_id":null,"required":"0","unique":"0","multiple":"0","weight":"3"},{"name":"parent","label":"","display_helper":"","input_helper":"input_category","comment":"","coltype":"pick","pickval":"category","pick_filter":"name=''","pick_orderby":"","sister_field_id":"330","required":"0","unique":"0","multiple":"0","weight":"1"},{"name":"children","label":"","display_helper":"","input_helper":"input_category","comment":"","coltype":"pick","pickval":"category","pick_filter":"name=''","pick_orderby":"","sister_field_id":"329","required":"0","unique":"0","multiple":"1","weight":"2"}]}},"templates":[{"name":"input_category","code":"<?php\n$indent = '';\nfor($x=0;$x<$this->category_level;$x++)\n{\n$indent .= ' ';\n}\nif(!empty($indent))\n{\n$indent .= ' - ';\n}\nif($this->category_multi==1)\n{\n?>\n<div<?php if($this->category_pod_id!=$this->get_pod_id()){ ?> class=\"option<?php if(in_array($this->get_field('id'),$this->category_active)){echo ' active';} ?>\"<?php } if($this->category_pod_id==$this->get_pod_id()){echo ' style=\"background-color:#DDD;\"';} ?> value=\"<?php if($this->category_pod_id==$this->get_pod_id()){echo '0';}else{echo $this->get_field('id');} ?>\"><?php echo $indent; ?>{@name,category_texturize}<\/div>\n<?php\n}\nelse\n{\n?>\n<option <?php if(in_array($this->get_field('id'),$this->category_active)&&$this->category_pod_id!=$this->get_pod_id()){echo ' SELECTED';}elseif($this->category_pod_id==$this->get_pod_id()){echo ' DISABLED';} ?> value=\"<?php if($this->category_pod_id==$this->get_pod_id()){echo '0';}else{echo $this->get_field('id');} ?>\"><?php echo $indent; ?>{@name,category_texturize}<\/option>\n<?php\n}\n$child = new Pod('category');\n$child->category_multi = $this->category_multi;\n$child->category_pod_id = $this->category_pod_id;\n$child->category_active = $this->category_active;\n$child->category_level = ($this->category_level+1);\n$child->findRecords('t.name',-1,'parent.id='.$this->get_field('id'));\nif(0<$child->getTotalRows())\n{\n echo $child->showTemplate('input_category');\n}"}],"helpers":[{"name":"input_category","helper_type":"input","phpcode":"<?php\n$category_active = array();\nif (!empty($value))\n{\n foreach ($value as $key => $val)\n {\n if(!empty($val['active']))\n {\n $category_active[] = $val['id'];\n }\n }\n}\n$category = new Pod('category');\n$category->category_multi = $field['multiple'];\n$category->category_pod_id = ($this->datatype=='category')?$this->data['pod_id']:0;\n$category->category_active = $category_active;\n$category->category_level = 0;\nglobal $the_category_sql,$the_category_count;\nif($the_category_sql==null)\n{\n$category->findRecords('t.name',-1,'parent.id IS NULL');\n$the_category_sql = $category->sql;\n$the_category_count = 2;\n}\nelse\n{\n\/\/ prevent caching bug in 1.8.3\n$category->result = pod_query($the_category_sql.' #input_category'.$the_category_count);\n$category->total_rows = pod_query(\"SELECT FOUND_ROWS()\");\n$category->sql = $the_category_sql;\n$the_category_count++;\n}\nif(0<$category->getTotalRows())\n{\nif($field['multiple']==1)\n{\n?>\n<div class=\"form pick <?php echo $name; ?>\" id=\"<?php echo $css_id; ?>\">\n<?php echo $category->showTemplate('input_category'); ?>\n<\/div>\n<?php\n}\nelse\n{\n?>\n<select class=\"form pick1 <?php echo $name; ?>\" id=\"<?php echo $css_id; ?>\">\n<option value=\"0\">-- Select One --<\/option>\n<?php echo $category->showTemplate('input_category'); ?>\n<\/select>\n<?php\n}\n}\nelse\n{\n?>\n<p>No categories have been added yet.<\/p>\n<?php\n}"},{"name":"category_texturize","helper_type":"display","phpcode":"<?php echo wptexturize($value); ?>"}]}
1.0.1 Notes
Bug fix and clean up, much less code doing more :-)
About this Package
Nested Categories with Input Helper and Templates that can be customized - Just plug and play!
All Versions
1.0.1
1.0.0