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 8404459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:36:22+00:00 2026-06-09T22:36:22+00:00

I want to print the $tabs array in Drupal 7. So, I´ve tried adding

  • 0

I want to print the $tabs array in Drupal 7.
So, I´ve tried adding this code inside my node.tpl.php:

  <?php
  echo '<div class="btn-group">';
  foreach($tabs as $tab=>$link) {
    echo '<button class="btn"><a href="$link">$tab</a></button>';
  };
  echo '</div>';
  ?>

But, it´s not printing anything… so I´m sure this is somewhat wrong.
Maybe because this should be inside the page.tpl.php? Is there a syntax problem that I didn´t catch?

Thanks for your help!!

Rosamunda

  • 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-06-09T22:36:23+00:00Added an answer on June 9, 2026 at 10:36 pm

    One problem that I see is that you are attempting to print variables that are contained inside of single quotes. PHP does not interpolate variables inside of single quotes, but it will inside of double quotes. Try changing your echo to this:

    echo '<button class="btn"><a href="' . $link .'">' . 
        $tab . '</a></button>';
    

    From the manual:

    Note: Unlike the double-quoted and heredoc syntaxes, variables and escape
    sequences for special characters will not be expanded when they occur in
    single quoted strings.

    For more information see the manual entry for Strings

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print just the HTTP status code for a web page retrieved
I want to print the ID of the comment (eg. 10151828637085391_33268745 ) from this
I want to print all the prime numbers between two numbers. This is my
I want to add some tabs in the node/%/edit page from my module called
For debugging I want to echo or print my MySQL with html replacements for
Jquery tab control displaying 7 tabs. When I print the page I only want
I have a form such as the below: <form name=basketSelectionForm action=processBasket.php method=POST> <div id=tabs-1>
I have a page I want to print this page. On print button i
I Want Print DataBase Schema in Microsoft Sql Server Compact Edition. Maybe Exist Some
i have a list of posts. i want print some words of post content

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.