Display Domain Name

How would I display the domain name of the page I am at. Lets say it it http://www.eyeglasseshut.com/comfortable-prescription-eyeglasses.htm and I want to display desilva.biz. Exactly like that. No www, or http:// included.

In fact, it is very use to let PHP do such thing:

$hostname = $_SERVER[‘SERVER_NAME’];
$hostname = str_replace(‘www.’, , $hostname);

echo $hostname;

Posted in Php Code. Comments Off on Display Domain Name »

How to add 10 hot wordpress posts

If you want to add 10 host post at your right bar, just copy and past the following code:

<h2>Hot PHP Posts</h2>
<ul>
<?php $result = $wpdb->get_results(“SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 10″);
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>
<li><a href=”<?php echo get_permalink($postid); ?>” title=”<?php echo $title ?>”>
<?php echo $title ?></a> (<?php echo $commentcount ?>)</li>
<?php } } ?>
</ul>

Posted in Php Code, WordPress. Comments Off on How to add 10 hot wordpress posts »

Using PHP to Generate Strong Password

If you want to have very strong password to protect your account, here is the code for :

<code>
<?php
 
function generatePassword($length=9, $strength=0) {
    $vowels = ‘aeuy’;
    $consonants = ‘bdghjmnpqrstvz’;
    if ($strength & 1) {
        $consonants .= ‘BDGHJLMNPQRSTVWXZ’;
    }
    if ($strength & 2) {
        $vowels .= “AEUY”;
    }
    if ($strength & 4) {
        $consonants .= ‘23456789’;
    }
    if ($strength & 8) {
        $consonants .= ‘@#$%’;
    }
 
    $password = ”;
    $alt = time() % 2;
    for ($i = 0; $i < $length; $i++) {
        if ($alt == 1) {
            $password .= $consonants[(rand() % strlen($consonants))];
            $alt = 0;
        } else {
            $password .= $vowels[(rand() % strlen($vowels))];
            $alt = 1;
        }
    }
    return $password;
}
 
?>
</code>

Posted in Php Code, Php Study. Comments Off on Using PHP to Generate Strong Password »

How to control WordPress 9.2 tag cloud font size?

We all know that WP has added widget_tag_cloud_args filter, you can use this function to override the default arguments that are passed to the wp_tag_cloud function to change the tag cloud font size you like. This filter provides a keyed array, where the smallest, largest, and unit keys represent the smallest font size, the largest font size, and the unit (‘pt’, ‘em’, ‘px’, etc) used by the default tag cloud widget.
(more…)

Posted in WordPress. Comments Off on How to control WordPress 9.2 tag cloud font size? »

Easy way do delete files from cpanel

Sometimes we need to empty all files under a web hosting, how to do then?

 Very simple, just login your cpanel, click “File Manager” and choose “public_html”, del  “public_html” and rebuild a new one. That’s it! Very easy, right!

 Somebody may ask how to del part of the files, also very easy. Go to  “public_html”, and choose the files you want to delete, and del them.  Simple?

Posted in Apache, Web Hosting. Comments Off on Easy way do delete files from cpanel »

Custom content to a specific category page of X-cart

When we go to a specific x-cart category, we can put there some custom content above the category thumbnails. We need to modify skin1/customer/main/subcategories.tpl and just after the h1 tag (or any other place we want it to show)

{if $current_category.category eq “100”}show cusotm contents, prescription glasses{/if}
{if $current_category.category eq “200”}show cusotm contents, men’s glasses{/if}
{if $current_category.category eq “300”}show cusotm contents, women’s glasses{/if}

replace “100,200,300” with the category id

Posted in X-Cart. Comments Off on Custom content to a specific category page of X-cart »

Add WordPress Category Description

Usually wordpress category description does not show even we add each wordpress category description at WP Administration Panel. Any method to show category description? Yes! Follow me:

Go to Appearance –> Editor, and click Category Template (category.php) .

 Add <div><strong><?php single_cat_title(‘Currently browsing’); ?>
</strong>: <?php echo category_description(); ?></div> 

at proper place. (more…)

Posted in WordPress. Comments Off on Add WordPress Category Description »

Install WordPress on IIS of dailyrazor.com

Edit web.config, the file is under the hosting of dailyrazor.com.  Add the following code to web.config:

<?xml version=”1.0″?>
<configuration>
<system.web>
<customErrors mode=”Off”/>
</system.web>
<system.webServer>
<httpErrors errorMode=”Detailed” />
<rewrite>
    <rules>
        <rule name=”Main Rule” stopProcessing=”true”>
            <match url=”.*” />
            <conditions logicalGrouping=”MatchAll”>
                <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />
                <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />
            </conditions>
            <action type=”Rewrite” url=”index.php” />
        </rule>
    </rules>
</rewrite>
</system.webServer>
</configuration>

Please note that max password length for database user is 12 characters. And FastCGI Extension for IIS 6.0 and IIS 5.1 should be installed also.

Posted in Other. Comments Off on Install WordPress on IIS of dailyrazor.com »

How to use PHP to add text for Zen Cart?

I want to add some text at the footer of Zen Cart, how to do? In fact, it is very simple. Just modify some code as the following.

Posted in Php Functions. Comments Off on How to use PHP to add text for Zen Cart? »

How to ask somebody else to write PHP articles?

We often need PHP related articles, if we do not have enough time, we can ask other PHPer for help. Here is an example on how to find good PHPer to write for you:

I am looking for someone to write me 10×500 word articles for the PHP Study niche (keywords to be given when we reach an agreement).

I will pay $20 for the 10 articles but please only contact me if:

1- You are a native english speaker or someone that can write near-perfect English. I want the articles to really make sense.

2- I want the articles to be relevant and not just some fluff to fill the 500 words. Make it informative and appealing.
3- All articles should have quality unique content, not just rewrite others articles. If you have PHP knowledge, you will have more chances to get the job.

Please send me a short sample of your work.

If you think you can write me the 10 articles the way I want them then please contact me asap. If we can cooperate well, I will need more PHP articles every month.

Posted in Other. Comments Off on How to ask somebody else to write PHP articles? »
King Php Science Designed by:KingPhp.com Welcome, you are from: 23.20.54.196