Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015468
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:37:22+00:00 2026-05-20T09:37:22+00:00

I have read the docs over and over trying to wrap my head around

  • 0

I have read the docs over and over trying to wrap my head around this seemingly simple task. Basically, I have a template with a ‘skip navigation’ div hard-coded in html.tpl.php that I do not want on front-page.

My idea was to set a $vars[‘skiplink’] variable in theme_preprocess_page. Since this variable contains a few lines of html markup, I was aiming for something as seen in garland theme:

function garland_preprocess_page(&$vars) {
  // Move secondary tabs into a separate variable.
  $vars['tabs2'] = array(
   '#theme' => 'menu_local_tasks',
   '#secondary' => $vars['tabs']['#secondary'],
  );

 <snip>

I would like to have the html in a themable function or even a template, but I cannot even get this snippet to work:

/**
 * Override or insert variables into the page template.
 */
function morin_preprocess_page(&$vars) {
  // add skiplink markup
  $vars['skiplink'] = 'hello world';
 }

This generates a notice:

Notice : Undefined variable: skiplink in include() (ligne 14 in /var/dev/morin/www/sites/all/themes/morin/templates/html.tpl.php).

Can anyone slap me with a clue? I would really like to understand how to do this with both methods, ( template & function ). I’m also wondering if this should be done in a module?

I realise there are probably 10 ways to skin this cat, so any insights on pros/cons of methods used are welcome.

Ok I figured out I was using the wrong preprocess function, setting $vars[‘skiplink’] in preprocess_html is the way to go for top-level variables.I still have yet to figure out in a clear way how to associate this variable to a template file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:37:23+00:00Added an answer on May 20, 2026 at 9:37 am

    The preprocess hooks follow this pattern:

    <theme name>_preprocess_<template name>
    

    So if you want to modify the variables for “html.tpl.php” you want to use this hook:

    <theme name>_preprocess_html(&$variables)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the GOLD Homepage ( http://www.devincook.com/goldparser/ ) docs, FAQ and Wikipedia to
I have read this post about how to test private methods. I usually do
I have read the documentation on this and I think I understand. An AutoResetEvent
i have searched google, tried to read adhearsion docs and make sense of the
I have read through several reviews on Amazon and some books seem outdated. I
I have read a lot that LISP can redefine syntax on the fly, presumably
I have read about partial methods in the latest C# language specification , so
I have read that using database keys in a URL is a bad thing
I have read on Stack Overflow some people that have converting to C#2.0 to
I have read (or perhaps heard from a colleague) that in .NET, TransactionScope can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.