Hi,

I made a new template node--bidprentje.tpl.php

With

<?php print render($content['field_acternaamovl']);
           print render($content['field_voornaamovl']);?>

I can display those fields, but they are on different lines, with the label printed.
What I want is to display the content on one line with one or no labels.
What must I put in my node--bidprentje.tpl.php to get that?

see http://stambomen.net/content/aarnoutse-maria#overlay-context=content/aar...

Thanks,
fred

Comments

VM’s picture

you can utilize CSS to hide field labels and set fields to be inline by floating them.

baltusf’s picture

Thanks, that is the only way? I know in D6 you could do it in a node-x.tpl.php with

<?php echo $node->field_contactpersoon[0]['view'];?>

So I have to put the css-classes for the desired inline fields in the node--bidprentje.tpl.php and in the articles.css?
Or is it better to make a new css and put it in the css-directory of the theme i use? Is that css then automaticly included?

I changed articles.css and added

article .field-name-field-acternaamovl .field-name-field-voornaamovl {
	 display:inline;
	 }

But i don't see any change. Am I on the right way or not? Can you help?

If have found something out without CSS, see http://stambomen.net/content/aarnoutse-maria , but maybe the more usefull and better method is with CSS. Can anyone give me a clue?

Second question:
In the node bidprentjes I have also a reference item BronId to another entity, namely Bron. How can i get a field from that entity in this display?

Gr.
fred

VM’s picture

try a css float rather than a display inline.

hiding the field label in the tpl.php file fine too as is using a preprocess function in template.php

baltusf’s picture

Thanks, it's not working with css, probably i do something wrong. I think i program it in the tpl.php file because it's a very specific node. I have include it now in a content type, but i think the best way is to put it in an entity. How I must do it, i must figure out.
When i have to load the data for the node, 5,000 records it takes a lot of time, deleting them take much more time... And i have to load more then 300,000 records ;)

The node shows data of memorial cards of people deceased.

gr,
fred

Jaypan’s picture

This can and should be done with CSS.

baltusf’s picture

Hi Jaypan,

Can you help me? Can you give a clue? I have search in all kind of groups and on the internet, but i did not find it.

Thankx,
Fred

Jaypan’s picture

What does the HTML look like?

baltusf’s picture

Do you mean the node--bidprentje.tpl.php? That's is a copy of the node.tpl.php from the sky-theme.

<article id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <?php print $unpublished; ?>

  <?php print render($title_prefix); ?>

  <?php if(!empty($user_picture) || $title || (!empty($submitted) && $display_submitted)): ?>
    <header<?php print $header_attributes; ?>>

      <?php if(!empty($submitted) && $display_submitted) print $user_picture; ?>

      <?php if ($title && !$page): ?>
        <h1<?php print $title_attributes; ?>>
          <a href="<?php print $node_url; ?>" rel="bookmark"><?php print $title; ?></a>
        </h1>
      <?php endif; ?>

      <?php if ($display_submitted): ?>
        <div class="submitted"><?php print $submitted; ?></div>
      <?php endif; ?>

    </header>
  <?php endif; ?>

  <?php print render($title_suffix); ?>

  <div<?php print $content_attributes; ?>>
  <?php
    hide($content['comments']);
    hide($content['links']);
    print render($content);
  ?>
  </div>

  <?php if ($links = render($content['links'])): ?>
    <nav<?php print $links_attributes; ?>><?php print $links; ?></nav>
  <?php endif; ?>

  <?php print render($content['comments']); ?>

</article>

At the end I added now some code

<h2>Hi, Question?</h2>
<p>What i want is e.g. </p>
<p>Overledene : Aarnoutse, Maria</p>
<p>but I got this:</p>
 <table>
 <tr><td>
 <?php print render($content['field_acternaamovl']);
       print render($content['field_voornaamovl']);
       print render($content['field_bronnaam']);
       ?>
   
 </td>
 </tr>
 </table>
<p>With <strong>$content['field_acternaamovl']['#label_display'] = 'hidden' : and  print render($content['field_acternaamovl']); </strong>the label is hidden.</p>
         <?php $content['field_acternaamovl']['#label_display'] = 'hidden';
         print render($content['field_acternaamovl']); ?>

<p>With <strong>print $content['field_acternaamovl']['#items']['0']['value'].', '.$content['field_voornaamovl']['#items']['0']['value'];?> </strong>I have more control in my node--bidprentje.tpl.php</p>
         

          
           <?php         print 'Overledene : '.$content['field_acternaamovl']['#items']['0']['value'].', '.$content['field_voornaamovl']['#items']['0']['value'];
          ?>
 <h3>But how can I do this within my articles.css file?</h3>        
  
<h2>....</h2>

to try something. You can see it on http://stambomen.net/content/aarnoutse-maria

What I want to do is putting some fields inline with another label in front and for example where "Soort relatie:
w" is displayed I want the text "Soort relatie: Widow "
And where BronId 1 is standing I have to display the description of that item (from an other enity"

Jaypan’s picture

That's the PHP, not the HTML.

baltusf’s picture

I know.... which one do you mean? I don't see a .html-file within sites/all/themes/adaptivethem or sites/all/themes/sky only a html-elements.css

VM’s picture

The HTML that is rendered when the page is viewed in the browser.

baltusf’s picture

Ok, beneath the article part... Do you also need the includes css-style sheets?
For the html see http://pastebin.com/aEbb2zJH

Jaypan’s picture

You should be able to do it by adding this css to your theme:

.field-name-field-acternaamovl {float:left;}

baltusf’s picture

Thanks, it works. Can i then change and hide the labels?

Now i got "Achternaam overledene: AarnoutseVoornaam overledene: Maria"

But i want "Overledene: Aarnoutse, Maria"

VM’s picture

you can target the field-label class and use a display: none;

However, you may need to be more precise with your CSS in this case else you hide the field labels on the entire site.

baltusf’s picture

Ok, I have then two options. Put some code in the css-file or to put it in the node file. Maybe the last option is better, because i sometime need an other label name instead .

Can I also change the current label with something like..
$content['field_acternaamovl']['#label_value'] = 'DEMO'?

VM’s picture

you don't need to adjust the tpl.php for this. You can use precise css to target elements on a specific node, a specific content type and so on.

With reference to:

Can I also change the current label with something like..
$content['field_acternaamovl']['#label_value'] = 'DEMO'?

Have you tested?

baltusf’s picture

I have not tested it what you ask, by "with reference"

But, one last question regarding to this, with what css-code can i change the value of the label?

I have nnow changed some fields... see http://stambomen.net/content/aarnoutse-maria#overlay-context=content/aar... but i have now to:

  1. change the first label value
  2. hide the second label and add a space, or replace the seconde label with ", "
VM’s picture

no. CSS is for styling. the CSS was offered to aid in removing the label which was an option you asked about in the opening post.\

Seems to me if you need a field label changed it makes sense to change the label of the field in your content type.

KCPeezy’s picture

I ran into this issue earlier. I got the following answer from this post, https://www.drupal.org/node/1234186

"...you set the label to 'hidden' on the 'manage display' tab for the content type..."

VM’s picture