Adding a menu on the left hand side - Page 2 Adding a menu on the left hand side - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Adding a menu on the left hand side

Started by Haelios, March 17, 2004, 12:35:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shoobeedoodoo

@Haelios, the menu on the left hand side is static html, I couldn't get the dynamic to work, as coppermine would stack everything below it, but now I'm interested in trying to use the return function instead of the include function, as alexisb had suggested.

alexisb

Now it's working for me, as I put in my last post: You have to return a value (in most cases is a string) from your function.

Regards!.

Haelios

Well done alexisb, you just solved my problem  :wink:

Just for the record, this was the code that I ended up using. I think it's pretty safe (just in case my dynamic page gets a bit big) but I'm sure that there is a better way to do it, so please let me know if you have a more cunning way.


// Adds the left menu
function theme_chu_menu_left()
{
        //include_once('http://jcr.chu.cam.ac.uk/menu.php');
        $handle = fopen("http://jcr.chu.cam.ac.uk/menu.php", "r");
        $leftmenu = "";
       
        do {
           $lmdata = fread($handle, 8192);
           if (strlen($lmdata) == 0) {
                   break;
           }
           $leftmenu .= $lmdata;
        } while (true);
        fclose($handle);
       
        return $leftmenu;
}


Thanks again gaugau for the help :)

Sid

Joachim Müller

haven't tested, but you could try this:
// Adds the left menu
function theme_chu_menu_left()
{
   $leftmenu = "";
   ob_start();
   include_once('http://jcr.chu.cam.ac.uk/menu.php');
   $leftmenu = ob_get_contents();
   ob_end_clean();    
   return $leftmenu;
}
GauGau