Skip to main content
Post Merged (destination) from drupal.stackexchange.com/questions/82491/…
removed the second question, since it has been asked in a different question
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Fields as strings Displaying the username of the user who created the node in the node template file

I've got two similar problems.

I created file node--my_content_type.tpl.php.

In that file, where I'd like to takeprint the username as string. I tried the following code, but unfortunately it doesn't work. How can I do it?

<?php 
  print $name;
?> 

but unfortunately id doesn't work. How can I do it?

The second one:

In my content-type I've got several fields, e.g. 'price' as real-valued field. As above , I'd like to take 'price' as string. I've no idea, how can I do it.

Fields as strings

I've got two similar problems.

I created file node--my_content_type.tpl.php.

In that file I'd like to take username as string. I tried

<?php 
  print $name;
?> 

but unfortunately id doesn't work. How can I do it?

The second one:

In my content-type I've got several fields, e.g. 'price' as real-valued field. As above , I'd like to take 'price' as string. I've no idea, how can I do it.

Displaying the username of the user who created the node in the node template file

I created file node--my_content_type.tpl.php, where I'd like to print the username as string. I tried the following code, but unfortunately it doesn't work. How can I do it?

<?php 
  print $name;
?> 
deleted 13 characters in body
Source Link
4life
  • 4.7k
  • 8
  • 26
  • 25

I've got two similar problems.

I created file node--my_content_type.tpl.php.

In that file I'd like to take username as string. I tried

<?php 
  print $name;
?> 

but unfortunately id doesn't work. How can I do it?

The second one:

In my content-type I've got several fields, e.g. 'price' as real-valued field. As above , I'd like to take 'price' as string. I've no idea, how can I do it.

I've got two similar problems.

I created file node--my_content_type.tpl.php.

In that file I'd like to take username as string. I tried

 
 

but unfortunately id doesn't work. How can I do it?

The second one:

In my content-type I've got several fields, e.g. 'price' as real-valued field. As above , I'd like to take 'price' as string. I've no idea, how can I do it.

I've got two similar problems.

I created file node--my_content_type.tpl.php.

In that file I'd like to take username as string. I tried

<?php 
  print $name;
?> 

but unfortunately id doesn't work. How can I do it?

The second one:

In my content-type I've got several fields, e.g. 'price' as real-valued field. As above , I'd like to take 'price' as string. I've no idea, how can I do it.

Source Link
user19455
  • 253
  • 1
  • 4
  • 11

Fields as strings

I've got two similar problems.

I created file node--my_content_type.tpl.php.

In that file I'd like to take username as string. I tried

 
 

but unfortunately id doesn't work. How can I do it?

The second one:

In my content-type I've got several fields, e.g. 'price' as real-valued field. As above , I'd like to take 'price' as string. I've no idea, how can I do it.