try harder to find the main template and a function's template
If there is no a template (main template and function template) for the current language then try to find a template for a default language or for a first available language.
This commit is contained in:
@@ -123,9 +123,26 @@ Ezc::Pattern * p;
|
||||
if( p )
|
||||
{
|
||||
log << log3 << "Templates: function template taken from: " << fun_file << logend;
|
||||
return p;
|
||||
}
|
||||
|
||||
return p;
|
||||
p = patterns.Get(cur->request->function->template_index, locale.GetDefLang());
|
||||
|
||||
if( p )
|
||||
{
|
||||
log << log3 << "Templates: function template taken from: " << fun_file << " for a default language" << logend;
|
||||
return p;
|
||||
}
|
||||
|
||||
p = patterns.Get(cur->request->function->template_index, 0);
|
||||
|
||||
if( p )
|
||||
{
|
||||
log << log3 << "Templates: function template taken from: " << fun_file << " for a first available language" << logend;
|
||||
return p;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +174,7 @@ Ezc::Pattern * pattern = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Templates: content: there are not any patterns";
|
||||
log << log2 << "Templates: content: there is no an available pattern for the function" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -945,7 +962,25 @@ using namespace TemplatesFunctions;
|
||||
|
||||
}
|
||||
|
||||
return index;
|
||||
if( !index )
|
||||
{
|
||||
index = patterns.Get(pat_index, TemplatesFunctions::locale.GetDefLang());
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from: " << config->templates_index << " for a default language" << logend;
|
||||
|
||||
}
|
||||
|
||||
if( !index )
|
||||
{
|
||||
index = patterns.Get(pat_index, 0);
|
||||
|
||||
if( index )
|
||||
log << log3 << "Templates: index template taken from: " << config->templates_index << " for a first available language" << logend;
|
||||
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user