It's random, too damn random.


Loading Timer Code

February
14
2009
Posted by Shaibani | Tags: , ,

I’ve got a few people asking about how I got the seconds it took the page to load to display. Just wanna share the code:

1
<?php timer_stop(1); ?>  <?php echo $db->num_queries; ?>

Or you can simply use:

1
<?php echo('text before time' . timer_stop(0) . 'text after time'); ?>

HTML is allowed in text before time and text after time.

Works in a WordPress environment only. :-)

date Instead of the_time Code

February
6
2009
Posted by Shaibani | Tags: , ,

Last month, I published a post about the WordPress functionthe_time('Y') and the PHP function date('Y')

Well as I was browsing through a few old posts, which were published in 2008, I noticed that the year date in the footer changed back to 2008. I changed it to

1
<?php echo date('Y'); ?>

Then it stayed as 2009! By the way, I know this can be figured out through common sense, but some lack it, this is obviously for disclaimers, footers etc. – NOT for posts.

phpinfo Code

December
22
2008
Posted by Shaibani | Tags: ,

How to make your own phpinfo page…

Simply create a .php page and add this to it:

1
<?php phpinfo(); ?>

How simple… :-)

Year PHP Code II Code

December
13
2008
Posted by Shaibani | Tags: ,

You may have read my previous post — Year PHP Code. Here’s an extra thing…

What if you wanna display the next year? You add the following…

1
<?php echo date ('Y') + 1; ?>

Output: 2011
When it does turn 2011, it will automatically change to 2012!

You can change the + 1 to any number that suits your needs!

Year PHP Code Code

December
2
2008
Posted by Shaibani | Tags: , , ,

EDIT: date Instead of the_time

If you wanna use the current year for a copyright statement or whatever and not have to update it every year (if you’re that lazy :P ) Here’s how:

If you’re in a WordPress environment:

1
<?php the_time('Y'); ?>

Output: 2008
(Yes, I can execute PHP in my posts.)

And in any normal .php page, you can get the year from your server.

1
<?php echo date('Y'); ?>

Output: 2010
So on exactly 31/12/2008 11:59, it’ll be 2010, and the next minute, well.. you know what’s gonna happen. :-)

Iframes Out, PHP In: Revised Tutorials

December
2
2008
Posted by Shaibani | Tags: , ,

Iframes Out, PHP In

Ok from what I’ve been told my previous tutorial was too confusing. I’ll do it again. This time I’ll try to make it more detailed.

Yes, you heard me, Iframes out. Yes a site can work without them. Calm down :-| Why would you wanna get rid of Iframes?

1. They’re old
2. Too “limiting”
3. Its harder to get on Google etc. with them.
4. They’re un-professional IMO.
5. They rob scripts of their functionality.

I don’t hate them, I just dislike them.

So this is your index.html page, you should make sure tags are closed, and that there’s only one of the following tags:

  1. <html>…</html>
  2. <head>…</head>
  3. <title>…</title>
  4. <body>…</body>
(more…)

Iframes Out, PHP In Tutorials

August
30
2008

Rate: MehNot badVery goodPerfect! Loading ... Loading ...
Yes, you heard me, Iframes out. Yes a site can work without them. Calm down :-| Why would you wanna get rid of Iframes?
1. They’re old
2. Too “limiting”
3. Its harder to get on Google etc. with them.
4. They’re un-professional IMO.

So we’re gonna get rid of them using PHP :-D
Note: Remember to save all your files that use this method with the .php extension.
(more…)

Get Adobe Flash playerPlugin by wpburn.com wordpress themes