Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. try print_r() or var_dump() like this: <?php print_r($urlArray); // or var_dump($urlArray);
  2. Does the link take you to another page, or is it a pop-up or Ajax type of request?
  3. If you would post the code that is supposed to generate the XML, then perhaps we can help you.
  4. Share some code.
  5. I don't know if you have thought to create a new row, then get that row number and complete your transaction. If you are using auto-increment, two users shouldn't be able to make the same number row. If you're not using auto-increment, then you should still be able to create a row number that doesn't yet exist. I do this in my e-commerce system when orders are added to the database. I'm interested to hear more answers as well, as I am no DB guru.
  6. You just need to nest your views: $nested_view_data['title'] = 'Page Title'; $data['head'] = $this->load->view('head',$nested_view_data,TRUE); $this->load->view('main_tmpl',$data); This would assume you have a view named head, and there is a $title variable in it. This gets inserted into the main_tmpl view.
  7. Your view's form open URL should contain the $sid after the edit URL segment.
  8. Even if it does work, you should rewrite it to be more clear for maintenance and maintainability. Come back to something like that after 6 months and see how easy it is to figure out what you were doing.
  9. Sorry, but I can't lie to you. I think one thing you should do is go around the internet and look for websites that inspire you, then see how they did what they did. I'm not saying to rip off somebody's design, but perhaps if you look at a few sites, and consider things like their menus, footer, banner area, etc., you will be able to use what you like most and create something really cool.
  10. There's not much to like. You'd be better off using a free template, or Wordpress installation.
  11. I ended up finding one that will work. It's called plogger, and at plogger.org. Pretty nice actually.
  12. I got a design buddy that is looking for a free GUI photo gallery for one of his customers. I could make one, but I figured something like this has already been done a thousand times. If anyone has a suggested script and can tell me where to get it, I'd appreciate it. Searches on Google return a bunch of spammy websites. His customer needs to be able to upload/delete pictures. The gallery doesn't need to be fancy at all. Just display images from new on top down to old on bottom. No pagination or anything.
  13. Too wide for my browser to display correctly.
  14. I really like the site. Very unique.
  15. Also, one controller can display many views, and nested views (view within a view).
  16. It might be easier to show you what is working, and what I'm trying to convert into this recursive function: <?php public function make_category_menu() { $this->db->order_by('parent_id','asc'); if( $query = $this->db->get($this->config->item('categories_table')) ) { foreach($query->result_array() as $a) { // if top level if($a['parent_id'] == 0) { // create a top level category $menu[$a['category_name']] = array( 'category_id' => $a['category_id'] ); } else { // level 2 foreach($menu as $b => $c) { if($c['category_id'] == $a['parent_id']) { $menu[$b]['sub'][$a['category_name']] = array( 'category_id' => $a['category_id'] ); break; } else if(array_key_exists('sub', $c)) { // level 3 foreach($c['sub'] as $d => $e) { if($e['category_id'] == $a['parent_id']) { $menu[$b]['sub'][$d]['sub'][$a['category_name']] = array( 'category_id' => $a['category_id'] ); break; } else if(array_key_exists('sub', $e)) { // level 4 foreach($e['sub'] as $f => $g) { if($g['category_id'] == $a['parent_id']) { $menu[$b]['sub'][$d]['sub'][$f]['sub'][$a['category_name']] = array( 'category_id' => $a['category_id'] ); break; } else if(array_key_exists('sub', $g)) { // level 5 foreach($g['sub'] as $h => $i) { if($i['category_id'] == $a['parent_id']) { $menu[$b]['sub'][$d]['sub'][$f]['sub'][$h]['sub'][$a['category_name']] = array( 'category_id' => $a['category_id'] ); break; } else if(array_key_exists('sub', $i)) { // level 6 foreach($i['sub'] as $j => $k) { if($k['category_id'] == $a['parent_id']) { $menu[$b]['sub'][$d]['sub'][$f]['sub'][$h]['sub'][$j]['sub'][$a['category_name']] = array( 'category_id' => $a['category_id'] ); break; } else if(array_key_exists('sub', $k)) { // level 7 foreach($k['sub'] as $l => $m) { if($m['category_id'] == $a['parent_id']) { $menu[$b]['sub'][$d]['sub'][$f]['sub'][$h]['sub'][$j]['sub'][$l]['sub'][$a['category_name']] = array( 'category_id' => $a['category_id'] ); break; } } } } } } } } } } } } } } return $this->_create_menu_lists($menu, FALSE); } return FALSE; } If you compare that to my attempt at the recursive function, then you might see what I am trying to achieve. I'm going to bed. 3:13AM here. Thanks.
  17. Well, I guess I've got some more thinking to do. See, right now I have this working, but it's not in a recursion. It's also not limitless, which is what I was trying to make happen by using the recursion.
  18. Yes I can, but this only works for the first recursion. After that the indices need to get deeper: <?php // first loop $menu[$b]['sub'][$d]['sub'][$a[0]] // second loop $menu[$b]['sub'][$d]['sub'][$d]['sub'][$a[0]] // third loop $menu[$b]['sub'][$d]['sub'][$d]['sub'][$d]['sub'][$a[0]] // fourth loop $menu[$b]['sub'][$d]['sub'][$d]['sub'][$d]['sub'][$d]['sub'][$a[0]] and so on, because it is recursive (or trying to be). It's not that simple though, because with each loop, the value of $d would be set, so $d is not always the same value.
  19. Well, what I'm trying to do is make the array indices concatenate within a recursive function. Right now my attempt is creating a string which php is putting into an index. See lines 8 and 11. I don't know what else to do, or how to make this work, or I wouldn't be asking! <?php function recursion($a,$b,$c, $offset='') { global $menu; if(array_key_exists('sub', $c)) { foreach($c['sub'] as $d => $e) { $offset .= "['$d']['sub']"; if($e['category_id'] == $a[2]) { $menu[$b]['sub']{$offset}[$a[0]] = array( 'category_id' => $a[1] ); break; } else { recursion($a,$d,$e,$offset); } } } }
  20. No. that's not what I'm looking for. I want to be able to add up: '[0]' .= '[2]' and use the value [0][2], so this is the variable part that needs to be changing.
  21. I need to be able to designate an array element dynamically, so I thought to use a variable variable, but it doesn't work: $test = array(1,2); $num = "[0]"; echo $test{"$num"}; // expecting 1 Not working. Is this possible?
  22. Solved my problem, but I'd like to make it fully recursive for infinite levels of parents/childs, and I'm too tired to keep working: <?php $i['1'] = array('A' => '0'); $i['2'] = array('B' => '0'); $i['3'] = array('C' => '1'); $i['4'] = array('D' => '1'); $i['5'] = array('E' => '2'); $i['6'] = array('F' => '2'); $i['7'] = array('G' => '3'); $i['8'] = array('H' => '3'); foreach($i as $k => $v) { // if top level if(current($v) == '0') { // just add as top level $new[key($v)] = array(); } else { // this gives the name of the parent letter $parent_letter = key($i[current($v)]); // if matching key in tier one foreach ($new as $z => $y) { if($parent_letter == $z) { $new[$z][key($v)] = array(); break; } else { foreach($y as $u => $w) { if($parent_letter == $u) { $new[$z][$parent_letter][key($v)] = array(); break; } } } } } } print_r($new); /* expecting the following: array ( 'A' => array ( 'C' => array ( 'G', 'H' ), 'D' ), 'B' => array ( 'E', 'F' ) ) */
  23. I still need help, and think I might be very close. Any help would be appreciated: <?php $i['1'] = array('A' => '0'); $i['2'] = array('B' => '0'); $i['3'] = array('C' => '1'); $i['4'] = array('D' => '1'); $i['5'] = array('E' => '2'); $i['6'] = array('F' => '2'); $i['7'] = array('G' => '3'); foreach($i as $k => $v) { if(current($v) == '0') { $new[key($v)] = array(); } else { // this gives the name of the parent letter $x = key($i[current($v)]); // send parent letter and child letter to function $awc = array ( $x , key($v) ); array_walk_recursive(&$new, 'find_and_store', $awc); } } function find_and_store($h, $g, $awc) { if($g = $awc[0]) { $new[$g][$awc[1]] = array(); } } print_r($new); /* expecting the following: array ( 'A' => array ( 'C' => array ( 'G' ), 'D' ), 'B' => array ( 'E', 'F' ) ) */
  24. I have no idea where to start with this. I've got an array of items have an associative array containing a letter as the key, and a integer as value. The value is to represent the parent id, meaning that the item actually belongs inside an array of it's parent. So an example: <?php $i['1'] = array('A' => '0'); $i['2'] = array('B' => '0'); $i['3'] = array('C' => '1'); $i['4'] = array('D' => '1'); $i['5'] = array('E' => '2'); $i['6'] = array('F' => '2'); $i['7'] = array('G' => '3'); /* expecting the following: array ( 'A' => array ( 'C' => array ( 'G' ), 'D' ), 'B' => array ( 'E', 'F' ) ) */ Got any ideas for functions that will sort this way? Am I missing a simple way to do this?
  25. This question may not just be a CodeIgniter related question, but since I am working with CodeIgniter, the context of the question was how I determined where to post. CodeIgniter has an email class, and when using it, it defaults to 'mail' as the protocol. Other options are 'sendmail' and 'stmp'. In my adventures with CodeIgniter, I've never had to configure this option, but on my most recent project, sending email was doing VERY buggy things. Through trial and error, I found that changing the protocol to sendmail was all that was needed to be done to fix everything. What's really weird is that 'mail' would send standard email most of the time, but would never send html email. Also, mail delivery was totally random, and Google wouldn't accept the mail no matter what I did. I was even getting a confirmation (success) message when I used 'mail', so I never thought to change the protocol until a lot of time went by. I initially thought that there was some other problem, like with my controller, or the email content view. Is there a way to look at PHP info and know right away if the server uses mail vs. sendmail ??? I don't want to have to waste so much time with this again!
×
×
  • 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.