You have to check before rendering if that template exists, and if it doesn't, set the default template. This can be done by adding a filter that check that. So...
Add this filter to a lib/ folder, for example /lib/filters/ViewFilter.class.php
<!-- /lib/filters/ViewFilter.class.php -->
class ViewFilter extends sfFilter{
public function execute($filterChain){
if ($this->isFirstCall()){
//get context
$context = $this->getContext();
//get module name
$module = $context->getModuleName();
//get action name
$action = $context->getActionName();
//get template file name for this request
$templateFile = $action . "Success.mobile.php";
//set physical path of that template
$path = sfConfig::get('sf_app_module_dir').DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."templates".DIRECTORY_SEPARATOR. $templateFile;
//check if exists
if(!file_exists($path))
//if is not, set html format to render the {$action}Success.php
$context->getRequest()->setRequestFormat('html');
}
$filterChain->execute();
}
}
Then add to your filters.yml
<!-- /apps/frontend/config/filters.yml -->
rendering: ~
security: ~
# insert your own filters here
ViewFilter:
class: ViewFilter
cache: ~
execution: ~
And should be working :)
If you do not know what is a filter and what it does please refer to Symfony's Filters Guide to get you started.