Forums | Mahara Community

Developers /
Question concerning meunuitems in web.php


anonymous profile picture
Account deleted
Posts: 112

13 March 2010, 17:30

Hello,

     I have answering alot of my own questions and I guess I am smarter than I thought. Smile Anyways I am coding new blocks for certain pages that I figured out how to do by looking at the web.php. In the web.php the following line of code is where my question comes from. 

if ($USER->is_logged_in() && defined('MENUITEM') && substr(MENUITEM, 0, 11) == 'myportfolio') {
            if (get_config('showselfsearchsideblock')) {
                $SIDEBLOCKS[] = array(
                    'name'   => 'selfsearch',
                    'weight' => 0,
                    'data'   => array(),
                );
            }

Where does the 0, 11 come from and what does it represent? Now the self search only shows in up in this section.  I am sure they connect to the myportfolio section in some manner but, I am not sure how? If someone could shed some light on this it would be a great help. I am looking to add something similar to a few other pages. Thanks in advance.

anonymous profile picture
Account deleted
Posts: 25

14 March 2010, 23:26

The 0 and 11 are arguments to the substr function. All substr does is return a substring of its first argument - so in this case, the first 11 characters of MENUITEM. More info on the substr function here: http://php.net/manual/en/function.substr.php

Cheers,

Evan 

 

anonymous profile picture
Account deleted
Posts: 112

15 March 2010, 15:50

Evan,

        Thanks for that bit of information. I thought it somehow connected  to something in mahara. Well now, I know it's much simpler than that. Thanks a bunch.

3 results