Category archive

PHP

Post related to PHP

37 articles

CMS

Create template specific to node in drupal 6

If you want to have custom templates for your node. You can create templates specific to node ID as follows. Add the below function in your template.php if its not exists. function yourcurrentthemename_preprocess_node(&$vars, $hook) { $node = $vars[‘node’]; $vars[‘template_file’] = ‘node-‘. $node->nid; } If the functio

Mar 9, 2012

Read article

HTML

How to fix flash object z-index

If any of your html element is getting hide behind the flash object such as youtube video player, or any flash player/object Then you should call this function on body load. function fix_flash_z_index() { // loop through every embed tag on the site var embeds = document.getElementsByTagName(’embed’); for (i = 0; i

Feb 26, 2012

Read article

PHP

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

Dec 14, 2011

Read article

PHP

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();

Dec 3, 2011

Read article

PHP

How to check if requested url exits or not

$requestedUrl = “http://www.example.com/abc.php”; $tags = get_headers($requestedUrl); if(preg_match(“/Not Found/i”,$tags[0]) || preg_match(“/Service Unavailable/i”,$tags[0])) { echo “Requested Url does not exists”; } else { echo “Requested Url exists”; }

Feb 10, 2011

Read article

PHP

GD support

How to check if GD support is enabled or not. <?php var_dump(gd_info()); ?> If GD support is enabled then you will get an array in that you will get “GD Version”. If you didn’t get this that means GD support is not there . To enable GD support you should install GD library by the [&hellip;]

Jul 11, 2009

Read article