I have been creating a custom theme for my drupal website and I ran into this problem where the Drupal Administration Menu (module) disappears for custom themes that are not based on out-of-the-box themes. I did a lot of searching for a solution with no luck, so in the end I just ran through the code of existing themes to see what code is required for the menu. Hopefully I can help someone who may have the same question!

You basically need to have this code at the end of your page.tpl.php file:

<?php
 
print $closure
?>

This should go right before the closing /body html tag. Apparently Drupal requires it to run any dynamic javascript to run.

Comments

brei9000’s picture

Thank you! You solved my issue.

kirkhoward’s picture

I needed this so finish up the first part of my custom theme

jgarbe’s picture

Wow, that would have tanked all my dynamic javascript? You are a life-saver.

opdavies’s picture

Cheers!

aac’s picture

bookmarking!!

---~~~***~~~---
aac

texas-bronius’s picture

Cluttering to share my thanks :)

--
http://drupaltees.com
80s themed Drupal T-Shirts

mwadi’s picture

Thank you! Nice tip :)

dcolumbus’s picture

Perfect. Exactly what the problem was... is this instruction within the Drupal Handbook? If so, I missed it...

rajmataj’s picture

Perfect. Thanks!

extensive’s picture

On mysite this method is working.

Website Designer (Drupal Themer)
Extensive professionals
info@extensiveprofessionals.com

cithukyaw’s picture

Yours helped me.
Thank you very much.

Elehas’s picture

This is excellent. I've been making custom themes for 2 years now and never understood why the menu only displayed in /admin. Thanks so much man!!

-------------------

*/ no comment */

manish.kumar’s picture

Thanks a lot mate!! I had the exactly same issue and you saved my time.

-Manish :)

varsh2102’s picture

I'm running 6.2. I have the following as the last piece of my page.tpl code

<?php
 
print $closure;
?>
<?php
 
echo $closure;
?>

But still when i click the spanner button on the top left of my site, it does nothing. So am unable to access the admin menu at all. It is a different thing that when i physically type in website.com/admin, it throws an error (that i am tackling separately), but for now, the spanner does nothing. Can you help me here please/

voughndutch’s picture

Thank you to infiniti

Rho1and0’s picture

Excelent! tanks very much XD

herbiek’s picture

This message is a reply on the proposed solution, not on the message above.

I have put your solution in the html.tlp.php file as there is no closing /body statement in the page.tpl.php file.
However I get the message:

Notice: Undefined variable: closure in include() (line 45 of /home/admin/domains/"our_domain">/public_html/sites/all/themes/"our_themename"/templates/html.tpl.php).

It is missing the declaration of the closure variable?

SherpaHyde’s picture

Drupal 7 is different.
You will need this code - just before the closing body tag </body> at the bottom of html.tpl.php

<?php
print $page_bottom;
?>