Anyway to remove the Front Page and Dashboard sub-links?

Asked by tad on 2012-10-07

I've noticed that the Front Page and Dashboard links are always there, I'm wondering if there is any way I can remove those?

Question information

Language:
English Edit question
Status:
Solved
For:
PHPDevShell Edit question
Assignee:
No assignee Edit question
Solved by:
Greg
Solved:
2012-10-08
Last query:
2012-10-08
Last reply:
2012-10-08
Greg (gregfr) said : #1

There are several answers, based on how your site is structured.

If you have your own "theme", just don't include the menu.

If you use a theme from the distro, you can easily override a module method to filter out what you don't want.

You can also use an even simpler CSS based-solution: the "home" button as a "home" css class, so you can just add this to your css:

.home { display: none; }

Feel free to provide more info so I can give you the best advice.

greg

tad (bittiez) said : #2

The display none works flawlessly! Thank you, now that peaks my interest though, is there any fairly easy way to put menu items there from within a plugin?
Something like
$this->navigation->addMenuItem() or anything similar to that?

Greg (gregfr) said : #3

Do you want to ouput the whole menu bar at some point, or do you want to add a new menu inside the menu bar?

tad (bittiez) said : #4

Essentially all I want to do is add a sub menu item(same level as the Front Page link and Dashboard link) from within a plugin dynamically not from the config file if that's possible, if not it's not a problem.

Best Greg (gregfr) said : #5

LOL it is possible :)

Let me explain how you can find out about it.

First, what you want is to alter the theme, so open the file "/themes/cloud/theme.php" (provided you're using the default "cloud" theme). You'll have the whole page at a glance. In your browser, right-click the "front page" button and select "inspect element". You'll notice the element is a LI inside an UL of ID "bread", itself inside a DIV of ID "history". Compare to the theme php file and you'll find that code:

   <div id="history">
    <ul id="bread">
     <?php $template->outputBreadcrumbs() ?>
    </ul>
   </div>

So you know what you have to change is the method "outputBreadcrumbs()" of the PHPDS_template class. Open the file "PHPDS_template.class.php" and look for the method:

 public function outputBreadcrumbs ()
 {
  // Check if output should be modified.
  if ($this->modifyOutputBreadcrumbs == false) {
   print $this->navigation->createBreadcrumbs();
  } else {
   print $this->modifyOutputBreadcrumbs;
  }
 }

Well the solution is now at hand: you just fill the field "modifyOutputBreadcrumbs" with what you want, for example:

$default_bread = $this->navigation->createBreadcrumbs();
$my_bread = 'This goes <b>before</b> - '.$default_bread.' - this goes <b>after</b>';
$this->template->modifyOutputBreadcrumbs = $my_bread;

Of course this is a quick and dirty hack, because if another plugin does the same, only the last change will be seen. However it can show how you can easily change something by investiguating it.

tad (bittiez) said : #6

Thanks Greg, that solved my question.

Greg (gregfr) said : #7

You're welcome. Feel free to ask if you have any question.

You'll discover that PHPDevShell offer you many ways of altering the default behavior, depending on how/how much you want to change (and also how clean or fast you want it)