Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme.tpl.php and views-view-fields--2ththeme.tpl.php in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views?is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme.tpl.php and views-view-fields--2ththeme.tpl.php in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme.tpl.php and views-view-fields--2ththeme.tpl.php in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.

added 16 characters in body
Source Link
M a m a D
  • 3.8k
  • 2
  • 32
  • 62

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme.tpl.php and views-view-fields--2ththeme.tpl.php in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme and views-view-fields--2ththeme in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme.tpl.php and views-view-fields--2ththeme.tpl.php in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.

Source Link
M a m a D
  • 3.8k
  • 2
  • 32
  • 62

Your question is still unclear to me, but anyway I recommend to use different theme_hook_suggestion for the view and based on the condition use the appropriate suggested hook. in template.php:

function YOURTHEME_preprocess_views_view_fields(&$variables)
{
    $view = $variables['view'];
    if($view->name == "your_view_name")
    {
          if($view->current_display == "some_custom_display"){  
            $variables['somefield'] = $variables['fields_somefield'->content;
            if($condition_1 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__1ththeme';
            if($condition_2 == true)    
                $variables['theme_hook_suggestions'][]='views_view_fields__2ththeme';
              ...
    }
} 

now create files views-view-fields--1ththeme and views-view-fields--2ththeme in your theme directory. the $somefield is available in there and it returns the value of the fields_somefield field. In these files just print any field you want and no matter if they are set to be excluded from display or not, The output of the view is what you print in the theme file.

The is it possible to have one views-view--VIEWNAME--page.tpl for multiple views? is also helpful.

As I said I didn't fully understand your question, if some thing is wrong with my answer just let me on it.