Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By baltusf on
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
=-=
you can utilize CSS to hide field labels and set fields to be inline by floating them.
Thanks, that is the only way?
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
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
=-=
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
Thanks, it's not working with
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
This can and should be done
This can and should be done with CSS.
Hi Jaypan,
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
What does the HTML look like?
What does the HTML look like?
Do you mean the node-
Do you mean the node--bidprentje.tpl.php? That's is a copy of the node.tpl.php from the sky-theme.
At the end I added now some code
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"
That's the PHP, not the HTML.
That's the PHP, not the HTML.
I know.... which one do you
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
=-=
The HTML that is rendered when the page is viewed in the browser.
Ok, beneath the article part.
Ok, beneath the article part... Do you also need the includes css-style sheets?
For the html see http://pastebin.com/aEbb2zJH
You should be able to do it
You should be able to do it by adding this css to your theme:
.field-name-field-acternaamovl {float:left;}
Thanks, it works. Can i then
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"
=-=
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.
Ok, I have then two options.
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'?
=-=
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:
Have you tested?
I have not tested it what you
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:
=-=
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.
Hide labels on print fields...
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..."
=-=