WebsiteBaker Support (2.8.x) > Templates, Menus & Design

Grabbing the WB menu from a non-WB php webpage

(1/1)

SaBRENT:
Can anyone point me in the direction to pull a WB menu from a non-WB php webpage ?

Right now I am using file_get_contents() and preg_match() - I can't seem to get it to grab the whole menu it goes until a sub-menu page ends. this is what I am running:


--- Code: (php) ---
    function get_main_menu($regex,$content) 
    { 
        preg_match($regex,$content,$matches); 
        return $matches[1]; 
    }

    $hv_content = file_get_contents('http://www.yourdomain.com/home.php');
    $main_menu = get_main_menu('/ul id="menu">(.*)<\/ul>/isU',$hv_content); 

    echo"$main_menu";


--- End code ---

Agian the menu i am trying to pull has Sub-menus maybe it can be done with the way I have shown but I am unsure of how to finish the phrase right.

Navigation

[0] Message Index

Go to full version