Archive for March, 2010

How do I call two functions from the body tags onLoad event handler? JavaScript

Friday, March 26th, 2010

I think the title explains it all, :) . Ok how are we going to call simultaneously two JavaScript function on onLoad event?

Easy…

<body onLoad="functionName1();functionName2()">

Easy? yes it is…:)

The easiest way to get file’s extension name via PHP

Wednesday, March 17th, 2010

Hello, again I found a new way, easiest way(as far as I know) for us to find, get and use file extension name via PHP (PHP 5.2.0 or greater).

thru a function called “pathinfo()”. :) yup a pre defined PHP function to get file extension, and they put it there for us to abuse haha.

ok lets begin.

<?php
$file=pathinfo('http://www.yourwebsite.com/uploads/image.jpg');
 
echo $file['extension'];
 
?>

This of course will print “jpg”. Which is the file extension of our file image. Easy huh…

More on pathinfo()

<?php
$file=pathinfo('http://www.yourwebsite.com/uploads/image.jpg');
 
echo $file['dirname'], "<br />";
echo $file['basename'], "<br />";
echo $file['extension'], "<br />";
echo $file['filename'], "<br />";  
?>

this will print out the details below

http://www.yourwebsite.com/uploads
image.jpg
jpg
image

Thats it for pathinfo()! :) see u round…

Joomla fatal error: Allowed memory size of 8388608 bytes exhausted? – Problem Solved!

Tuesday, March 2nd, 2010

fatal error: Allowed memory size of 8388608 bytes exhausted?

Ran into this? chances are your memory limit is set to only 8MB, which is rather low for most of the scripts. Lucky you I discovered a quick fix and save you from the frustration trying to fix this :)

Ok, let me share what I found.

Open your configuration.php file located at the Joomla root folder, and insert this tiny little script just after the PHP open tag.

For example

<?php
ini_set('memory_limit','12M'); //recommended is 32MB, so they say but ill will put 12M for this example
//rest of the script follows...

save your configuration.php file and reload your page. Works like a wonder :) , Yes?

UPDATE: BTW for some reason when you installed Joomla and admin page is somewhat lost and scattered, This little code can fix it. I think you know the reason…ok chow