Skip to main content
added 264 characters in body
Source Link
jae.phoenix
  • 233
  • 2
  • 11

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all content types. Now, in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.

I tried adding content type to my views in drupal, then tried it that way:

<?php if ($fields['type']->content = 'animals'){} ?>

but the view looks through the document and see that there is a content type with that name, and prints the data anyway.

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all content types. Now, in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all content types. Now, in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.

I tried adding content type to my views in drupal, then tried it that way:

<?php if ($fields['type']->content = 'animals'){} ?>

but the view looks through the document and see that there is a content type with that name, and prints the data anyway.

added 5 characters in body
Source Link
jae.phoenix
  • 233
  • 2
  • 11

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all nodecontent types. No Now, in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all node types. No in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all content types. Now, in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.

Source Link
jae.phoenix
  • 233
  • 2
  • 11

Node Type in Views Template

I made a custom template for my view to print fields into a custom html syntax. The problem I have is that in the view I am calling all node types. No in my template file I want to display certain information depending on what content type the content is coming from.

For instance, I want something like this:

If (node->type['animals']{
    print 'this is the animal node';
}
else{
    print 'this is not the animal node';
}

My fields inside the view are printed as follows, but this works:

<?php print $fields['title']->content; ?>

The only problem I am having is calling the node type.