Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Amy Hoy http://www.ahoyhere.com

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

Debugging SimpleXML Objects

AGRH@!! SimpleXML bites the big one -- you can't even var_dump it to examine the contents and the controls are terrible. Luckily, you can convert it for debugging:

$sxml = simplexml_load_string($data);
// .. much hate between then and now... //
debugsxml($sxml);


function debugsxml($sxml) {
    $dom = dom_import_simplexml($sxml);
    printArray($dom);
}

function printArray($array){
    echo '<pre>';
    print_r($array);
    echo '</pre>';
}


Fix table width weirdness in IE6

If you have a table with rowspans and colspans, it's especially likely that IE6 will begin to ignore your width settings (even if they all add up to the right number) and create a monster table that spreads off into the distance. If your tables work perfectly in FF/Safari/etc, and in IE6 your content is positioned properly but the invisible elements of the table (visible only with borders on) extends to the side so that you get a horizontal scroll bar no matter what you do, you might want to try this drastic CSS tweak:

html {
    overflow-y: hidden;
}


If that doesn't work, try it in body:
body {
    overflow-y: hidden;
}


<disclaimer>Note that this is somewhat hackish, as a last resort if you *know* your tables are *fine* and IE6 is screwing up, and that overflow-x/y are IE6-only and not real CSS. </disclaimer>

set tinymce to use relative links

If installed under Mambo, edit:
mambots/editors/tinymce_exp.php

Lines 157-158:
  relative_urls : true,
  remove_script_host : true,

fix tinymce link editor default of target:_new

When installed in Mambo, edit
mambos/editors/tinymce_exp/jscripts/tiny_mce/plugins/advlink/link.php
lines 253-258:
<select name="target" id="target">
          <option value="_self" selected>_self&nbsp;(<?php echo _insert_link_target_same ?>)</option>
          <option value="_blank">_blank&nbsp;(<?php echo _insert_link_target_blank ?>)</option>
          <!--<option value="_parent">_parent&nbsp;(<?php echo _insert_link_target_parent ?>)</option>
          <option value="_top">_top&nbsp;(<?php echo _insert_link_target_top ?>)</option>-->
</select>
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS