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

  • Home
  • SEARCH
  • 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 6822759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:42:07+00:00 2026-05-26T21:42:07+00:00

I have several custom content types and in one specific one I need to

  • 0

I have several custom content types and in one specific one I need to offer two fields, one for the href for a link, and one for the text of a link this way I can build and style it with minimal user involvement of the HTML/CSS. I also have a custom node.tpl for this content type. My problem is that drupal throws divs around each field I create that aren’t in my template file for this content type (node-custom.tpl) and I can’t put the href for a link with divs around it inside <a href="<div id="something">google.co.uk</div>"></a> See my problem. Maybe I’m doing this all wrong so any other ideas are welcome.

Please note I’m trying to create this site with minimum involvement of HTML/CSS access for the user. I’m aware I could hand code the link in the field.

  • 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-26T21:42:07+00:00Added an answer on May 26, 2026 at 9:42 pm

    The easiest way to do this would be to use a preprocess function in your template.php file and build the link up manually:

    function mytheme_preprocess_node(&$vars) {
      $node = $vars['node'];
      if ($node->type = 'my_type') {
        $uri = $node->field_name_of_link_field[LANGUAGE_NONE][0]['value'];
        $text = $node->field_name_of_display_text_field[LANGUAGE_NONE][0]['value']; 
        $vars['my_link'] = l($text, $uri); // Using Drupal's l() function to render a link
      }   
    }
    

    Then in your node template file you’ll have access to the variable $my_link which you can output anywhere, and will contain the correct HTML for the link. Finally, go to the “Manage Display” page for your content type and set the display of the two fields you no longer need to output to ‘Hidden’.

    There are other ways so if that’s no good let me know

    EDIT

    Just to add, I think the easiest way to do this would actually be to install the Link module and use the provided field type instead of the two other fields you’re currently using.

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

Sidebar

Related Questions

I'm using a custom JLayeredPane. I have several Shapes which needed to be drawn
I have custom coded several enterprise applications for mid to large organizations to use
I have read several documentations about building custom ErrorHandler (by inheriting from IErrorHandler). Unfortunately,
I have a custom SharePoint page with several dataviews. The dataviews essentially filter documents
I have a custom UITableViewCell which contains several UIButtons. Each button's frame position is
I have a UIScrollView with a custom content view that uses drawRect to display
I have a custom uitableviewcell with several labels and I would like for some
I have several parts in my app where I use custom table view cells.
I have a custom content type in SharePoint which has an approval workflow associated
I have been banging my head on the desk for several days over this

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.