Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

  • Days Won


Andy_K last won the day on May 23 2018

Andy_K had the most liked content!

Community Reputation

1 Neutral

About Andy_K

  • Rank
  1. Don't seem to have an edit option on my previous post but I would just like to say thank you for all your help Barand. - I had to modify my array generation slightly to match your code as it didn't work in the multi-dimensional array, but I've now got it working and achieved what I wanted to do. Thank you again! Kind Regards, Andy
  2. Hello Barand, Thank you for all your assistance. - I will test this out later and see what happens. Kind Regards, Andy
  3. Hello Barand, Thank you for your continued assistance. Right now, the maximum is 5 (on the live version), but it could expand in the future. Kind Regards, Andy
  4. Hello, Thank you for the above. - Wouldn't that method require the depth of the array to be hard coded? Currently, the array is built dynamically so it can have 1 child or 100 children. The array is built using this function: function BuildTreeArray(array &$Elements, $BranchID = 0) { $Branch = array(); foreach ($Elements as $Element) { if ($Element['Branch_ID'] == $BranchID) { $Children = $this->BuildTreeArray($Elements, $Element['Article_ID']); if ($Children) { $Element['Children'] = $Children;
  5. Hello Barand, I don't want it on them all. - Basically, when the page is loaded, the Article_ID is in the URL so I need to find that Article_ID in the array and make it so all of it's parents have the element "Active". I'm trying to make it so I can add a class to all of the current pages parents <ul> tags so that part of the navigation is expanded. I have a jQuery solution in place, but it flickers when the page is loaded to "expand" the tree, which is annoying me, so I'm trying to come up with a solution where jQuery isn't required and it's done through the PHP and CSS. Hop
  6. Hello All, I have a piece of code that generates a multi-dimensional array from values in a database, but I'm wondering how I would search and add a new element to each parent: Array ( [52] => Array ( [Article_ID] => 52 [Branch_ID] => 0 [Article_Name] => @Test [Children] => Array ( [53] => Array ( [Article_ID] => 53 [Branch_ID] => 52 [Article_Name] => Testing
  7. I can't seem to edit my last post, but I've resolved the issue. - Bad placement of the $Html variable. Should have been under the first for loop rather than above it.
  8. Hello, I've currently got an issue where when using preg_replace in a forloop, it duplicates code: The code I'm using is: function GenerateSwitchDiagram($Code) { $Html = ""; $SwitchCount = preg_match_all('/\\[Switch(.|\n)*?\[EndSwitch]/', $Code, $SwitchContent); for($Switch = 0; $Switch < $SwitchCount; $Switch++) { preg_match_all('/\[Switch\s*([^\]]*)\s*\]/', $SwitchContent[0][$Switch], $SwitchTags, PREG_SET_ORDER); preg_match_all('/([^=\s]+)="([^"]+)"/', $SwitchT
  • 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.