function generate_last_post_url_for_branch($forumtopic_slug, $lft, $rght) { $objBranch = new Forumbranch(); $forum_path = $objBranch->getBranchSlugTree($lft, $rght); if (empty($forum_path)) { return ""; } $slugs = array(); foreach ($forum_path as $index => $branch) { $slugs[$index] = $branch['Forumbranch']['slug']; } array_push($slugs, $forumtopic_slug); return implode("/", $slugs); }