Advanced search  

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]

Pages: 1 [2]   Go Down

Author Topic: Adding a menu on the left hand side  (Read 12931 times)

0 Members and 1 Guest are viewing this topic.

shoobeedoodoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Adding a menu on the left hand side
« Reply #20 on: March 25, 2004, 09:36:52 pm »

@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.
Logged

alexisb

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Confirmed
« Reply #21 on: March 26, 2004, 05:32:18 am »

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!.
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #22 on: March 26, 2004, 11:41:09 am »

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.

Code: [Select]

// 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #23 on: March 26, 2004, 03:01:07 pm »

haven't tested, but you could try this:
Code: [Select]
// 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
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.016 seconds with 19 queries.