$ActualStr : ‘<div class=’bannerpicsd’ ><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>’;
$StrToReplaceWith = ‘This is the replaces str’;
Now you want to replace all the text inside the div tags with class name “bannerpicsd” from $ActualStr with $StrToReplaceWith
Then you can do as below:
$replacedStr = replace_tag_with_specific_attr_type(‘class’,’bannerpicsd’,$ActualStr,’div’,$StrToReplaceWith);
Result :
<div class=”bannerpicsd” >This is the replaces str</div>
Enjoy 🙂
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 < embeds.length; i++) {
embed = embeds[i];
var new_embed;
// everything but Firefox & Konqueror
if (embed.outerHTML) {
var html = embed.outerHTML;
// replace an existing wmode parameter
if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'");
// add a new wmode parameter
else
new_embed = html.replace(/
Example to call this function
$(document).ready(function () {
fix_flash_z_index();
});
So the $allowed_values will give you the array of the option list with the key value association.
Note: The “whatever_the_field_name_is” is the field name that you had specified while adding the field, you can get the field name from your 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 the select list generated would be as follows In case 1 :