dummy text generator
Categories: tool
Tags: generator, lorem, radom text, tool
need some dummy / random text as content prototypes but don’t want to use text like ‘content here’ or ‘blah blah blah’? very often you see dummy text beginning with ‘Lorem ipsum…’.
try this lorem ipsum generator to generate paragraphs and lists of text. the site also explains that it’s not a random text but taken from a latin literature.
2008-11-17 11:47:55 • Link • Comments • Trackbacks
browser compatibililty
Categories: css, tool, bookmark, browser, free
Tags: browser, compatibility, css, tool, web design
even though there are standards, some browsers still like to use their own standard, like … IE (surprise!?) – different versions of IE will also render your site differently.
in addition, there are million browsers and platforms out there. you can’t install everything nor have all those platforms to check your website compatibility.
to check what your site look like in other browsers and platforms, use this tool to ensure your site is more or less consistent or not too far out. note: be patient, it may take a while to get screenshots.
2008-11-13 10:42:56 • Link • Comments • Trackbacks
php: increase memory limit
Categories: php, unix, apache2
errors like ‘allowed memory size of x bytes exhausted’ or ‘zero size reply’ usually means there’s not enough memory allocated for php. you need to increase the value.
if you have admin access, you can edit /etc/php.ini, locate and update ‘memory_limit’ to values like 16M, 32M, 64M. this change is global to the system. restart apache after update.
if not, add this in php script:
PHP:
ini_set("memory_limit", "32M"); |
2008-10-31 10:21:59 • Link • Comments • Trackbacks
php: function with variable parameters
Categories: php
Tags: function, parameter, php
to define a function that takes any number of parameters, eg
PHP:
foo(); // no parameter | |
foo("a"); // 1 parameter | |
foo("a", "b", "c"); // more than 1 parameters |
to access the parameters passed to a function, use these php functions:
- func_num_args() – returns number of arguments or parameters
- func_get_arg($i) – get specific argument on the list
- func_get_args() – returns array of arguments passed
PHP:
function foo() { | |
for ($i = 0; $i < func_num_args(); $i++) { | |
echo "$i:" . func_get_arg($i); | |
} | |
} |
alternative way to access the parameters:
PHP:
function foo() { | |
foreach (func_get_args() as $i => $arg) { | |
echo "$i:" . $arg; | |
} | |
} |
2008-10-29 11:26:00 • Link • Comments • Trackbacks
xajax and radio buttons
to display a group of choices to select-only-one as radio buttons, the name and id parameters must be the same for all <input>.
the html code:
Code:
<input type="radio" name="option" id="option" value="1" onclick="xajax_click(this.value);" checked />option 1<br /> | |
<input type="radio" name="option" id="option" value="2" onclick="xajax_click(this.value);" />option 2<br /> | |
<input type="radio" name="option" id="option" value="3" onclick="xajax_click(this.value);"/>option 3<br /> |
to pass the value of radio button to xajax function, use this.value. not this.checked, as the value is always true when it’s clicked.
the xajax function:
PHP:
function click($value) { | |
$x = new xajaxResponse(); | |
switch ($value) { | |
case 1: | |
//do something | |
break; | |
case 2: | |
//do something | |
break; | |
case 3: | |
//do something | |
break; | |
} | |
} |
2008-10-24 10:28:53 • Link • Comments • Trackbacks