‘web development’ Archives
configure database using propel
$ ./symfony configure:database --name=propel --class=sfPropelDatabase "mysql:host=localhost;dbname=dbname" username userpassword
How to get the allowed option list in drupal theme template or view file
If you want to get the option list of the content type that you have created , then you can get the list as follows: $content_field = content_fields('whatever_the_field_name_is'); $allowed_values = content_allowed_values($content_field); So the $allowed_values will give you the array of the option list with the key value [...]
How to add select option in drupal while creating content type
Whenever you create any content type in drupal ( version 6 and above) and you required a filed of type select list, then you can provide the allowed values of the select option in two ways CASE 1 : option 1 option 2 option 3 CASE 2 : 1|option 1 2|option 2 3|option 3 Each new option has to be entered on a new line So enternally [...]
Replace multiple space with single space in PHP
If you want to replace multiple space with single space from a string you can use preg_replace function for this. Refer the below example preg_replace("!\s+!"," ",$yourstring); For example $yourstring = "This contain space"; $modifiedString = preg_replace("!\s+!"," ",$yourstring); echo $modifiedString; // This contain space // [...]
How to get symfony project base url in template file
To get the base url of your symfony project , you can use the below in your template file. $sf_request->getUriPrefix().$sf_request->getRelativeUrlRoot() And to get your current app URL. $sf_request->getUriPrefix().$sf_request->getRelativeUrlRoot().$sf_request->getPathInfoPrefix();
How to check PHP error before including any file in your script
Suppose you want to include/require any file in your scripts, But before doing so you want to confirm that the included or required file doesn't contain error. Then in that case you can use the below code to do the same. /* Implementation */
integrate window media player in your website
<html> <head></head> <body leftmargin="0" topmargin="0"> <table cellpadding="0" cellspacing="0" border="0"> <tr height="350"><td align="center"> <table cellpadding="0" cellspacing="0" border=1 bordercolor="black"> <tr> <td valign="top"> <OBJECT ID="MediaPlayer" WIDTH="320" [...]
update query in symphony (Method 2)
For example to execute query like UPDATE tableName SET column1 = 'abc',column2 = 'xyz' WHERE column ='1'; In symfony you can do it this way $c = new Criteria(); $c->add(MyTablePeer::COLUMN,1); $c->add(MyTablePeer::COLUMN1,'abc'); $c->add(MyTablePeer::COLUMN2,'xyz'); MyTablePeer::doUpdate($c); Thanks
Show tooltip on mouseover
Step 1: Copy this css style code into your header tage right before the end of header tag <style type="text/css"> #dhtmltooltip{ position: absolute; border: 1px solid red; width: 150px; padding: 2px; background-color: lightyellow; visibility: hidden; z-index: 100; filter: [...]
Sorting a two dimensional array in javascript
function sortArray(x,y) { return ((x < y) ? -1 : ((x > y) ? 1 : 0)); } var givenarr = ,,]; givenarr.sort(sortArray); ======================== The result array will be givenarr = ,,];
Latest music . videos and songs
PHP Manual