Set widget label from action file in symfony 1.4

In Action File ========================================================== $this->form = new youFormclassname(); To set individual Label $this->form->getWidget(‘widgetname’)->setLabel(‘widget Custom label’); To set multiple field label $this->form->getWidgetSchema()->setLabels(array( ‘field_name_1′    => ‘Field 1 Custom Lable’, ‘field_name_2′    => ‘Field 2 Custom Lable’, } ++++++++++++++++++++++++++++++++++++++ In Template File ============================================ <?php

Replace any text from html text by tag name with specific attribute in php

function replace_tag_with_specific_attr_type( $tagAttribute, $tagAttributeValue, $subjectStr, $tagName=null,$replaceStr ) { if( is_null($tagName) ) $tagName = ‘\w+'; else $tagName = preg_quote($tagName); $tagAttribute = preg_quote($tagAttribute); $tagAttributeValue = preg_quote($tagAttributeValue); $match_regex = “/<(“.$tagName.”)[^>]*$tagAttribute\s*=\s*”. “([‘\”])$tagAttributeValue\\2[^>]*>(.*?)<\/\\1>/”; preg_match_all($match_regex, $subjectStr, $matches, PREG_PATTERN_ORDER); $result = str_replace($matches[3],$replaceStr,$subjectStr); return $result; } Usage :

Replace any text from html text by tag name in php

function replace_tag_text($tagName,$subjectStr,$replaceStr) { $tagName = preg_quote($tagName); preg_match_all(‘{<‘.$tagName.'[^>]*>(.*?)</’.$tagName.’>}’,$subjectStr,$matches,PREG_PATTERN_ORDER); $result = str_replace($matches[1],$replaceStr,$subjectStr); return $result; } Usage : Say for Example $ActualStr : ‘<div><span style=”margin: 0px 0px 0px 0px; width: 540px;”>something</span><p style=”float: right; margin: -240px 0 0; width: 200px;”>This is the actual String</p></div>';