0

I have created a custom page page--about.tpl.php.
And want that page to hook it in menu.
I have gone through hook_menu but didn't get my answer.
I also read page template suggestion.
Tell me how I can do that.

  • Do you only want a link to your custom page to appear in some menu (in that case, which menu?), or is your custom page really a form and you need to also provide a callback to process this form? – Free Radical Jun 8 '14 at 4:17
  • just link to main menu.... Its a page... – Amrita Jun 8 '14 at 4:41
2

I think there are some confusions here.

First: Custom.tpl.php-files are not custom pages. They are custom templates for pages, and unless you need to have a different style or layout on your "about" page, there is no need for it.

Second: The hook_menu function has nothing to do with this, it is (mostly) for setting up callback functions for forms and hooking those forms up to the menu router system.

To create an "about" page for your site and make it appear in your site's main menu is much simpler. Do as follows.

  1. First create your "About" page as a "Basic page" on your site. To do so, navigate to Home » Add content » Create Basic page and just create the page. When done, press "Save".

  2. Make a note of the node path of this page. Let's say it is node/69.

  3. Navigate to Administration » Structure » Menus. To the right of "Main menu", click "add link".

  4. In the field "Menu link title", fill in the desired title (e.g. "About us").

  5. In the field "Path", fill in the node path (e.g. node/69 if that was the path you made of note of in step 2).

  6. Click "Save".

  7. Clear all caches (you always do this after changing the appearance of a Drupal site).

After going through the steps above, a tab linking to the "About us" page shall appear in the main menu.

If you want a custom layout for this page, you can create this as a template file. If the node path to the page is node/69, the file should be named page--node--69.tpl.php.

  • thank you.... I was just striking my head in drupal doc.... But one more think I want to ask that I read about custom as page--about.tpl.php. what exactly that. – Amrita Jun 8 '14 at 5:36
  • For an introduction to Drupal's PHPtemplate theme engine, you can for instance have a look at this: heim.ifi.uio.no/gisle/staging2/drupalprimer/drupal/… – Free Radical Jun 8 '14 at 5:39
  • Thank you.... Looks like good documentation. I am going through it. – Amrita Jun 8 '14 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.