Study PHP, Share PHP Code
2 useful skills of Vbulletin Version 4
November 5th, 2012 — admin
Here let me share my 2 useful skills about Vbulletin Version 4.
1. members that have visited the forum today for unregistered users also;
2. Similar Threads not show up
For first question, do as follows:
Posted in Vbulletin. Comments Off
2 SEO Skills on WordPress
September 10th, 2012 — admin
Here let me share 2 skills on wordpress seo. The default method of a post read more is usally shows as “read more…”, or “Continue reading”. This is very bad for our seo purpose. We all know that we’d bette use our keywords as text link or at least the text link should contain our main keywords. How to do then? We can use each post title instead “read more…” as default text link.
Posted in WordPress. Comments Off
How to use mysql to remove the hyperlink and remain with the text?
July 10th, 2012 — admin
If you have a lot of articles, and there some hyperlinks here and there, it will be very difficult for us to remove them one by one. For example, you have about 10,000 articles, if you check each articles, I am sure you will have to cost several days to remove the hyperlinks and keek the text.
There are 2 method to do this, one is using php code, we can read the article from mysql database, and using php to replace; another method, we can control mysql directly. For example, as we know, there are many people using dede cms to build sites, and all the articles is stored under body of dede_addonarticle.
Here, let share the second method with you, log in your mysql database via phpmyadmin, and choose your database, run the following sql:
update dede_addonarticle set body = replace(body,substring(body,locate(“<a “, body),locate(“>”, body,locate(“<a “, body))+1-locate(“<a “, body)),”");
Posted in MySQL. Comments Off
How to remove the title attribute using dreamweaver?
June 10th, 2012 — admin
Here are some html code:
<A title=”mens glasses” href=”http://http://www.zjjv.com///men-glasses”>Men’s Glasses</A>
<A title=”womens glasses” href=”http://http://www.zjjv.com///women-glasses”>Women’s Glasses</A>
<A title=”kids glasses” href=”http://http://www.zjjv.com///kids-glasses”>Kids Glasses</A>
If we do not need title attribute in these href code, and let them be:
Posted in Php Skills. Comments Off
How to Get URL of Current WordPress Page or Post?
May 28th, 2012 — admin
We often need to know how to get url of current wordpress page or post if we re-programming wordpress. Here I will share 2 methods with you. One is via PHP code, and the other is using wordpress function.
First, let me intruduce how to use PHP to achieve our demands. We can add the code to suitable pages, say footer.php. Go to your wordpress template, and edit footer.php. Here we use http://http://www.zjjv.com///15.htmlas an example.
Posted in Php Skills, WordPress. Comments Off
How to WordPress Show Latest Posts under Certain Category?
May 22nd, 2012 — admin
Sometimes we need to modify wordpress templates to meet our demands, for example, we need to show latest posts under certain category only, say category id is 11. How to do then? Here is the code I have used for http://www.zjjv.com/
<?php query_posts('showposts=5&cat=29'); while(have_posts()) : the_post(); ?> <ul> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> </ul> <?php endwhile;?>
I have add the above code for http://www.zjjv.com/ right bar, the complete code is:
<aside><div><h3>Housing News</h3><div></div></div> <?php query_posts('showposts=5&cat=29'); while(have_posts()) : the_post(); ?> <ul> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> </ul> <?php endwhile;?> </aside>
The code will show 5 lates posts under category 29.
Posted in WordPress. Comments Off
Skills on Display Orders of Zen-Cart.
April 3rd, 2012 — admin
Especially at the end of every month, we need to know how many orders we have. Here are 2 method you may like when you use Zen-Cart.
First, if you need to know certain latest new orders, say 2000, how to do then, you can use the following mysql command:
SELECT * FROM `orders` order by orders_id desc limit 0,2000; //show latest orders;
Second is we can use the following mysql code to show all the products with a month, say display all products within March, 2012:
SELECT date_purchased, SUM(order_total) FROM `orders` where date_purchased between “2012-03-01″ and “2012-03-30″;
For some phpmyadmin or mysql version, we need to use the followng code:
SELECT date_purchased, SUM(order_total) FROM orders where date_purchased between “2012-03-01″ and “2012-03-31″;
If we need to know all orders in a year, say 2011, how to then? Simple:
SELECT date_purchased, SUM(order_total) FROM `orders` where date_purchased between “2011-01-01″ and “2011-12-31″;
Here we can use SUM(order_total) to caculate total value within a period.
Show orders, not include unpaid and canceled orders within a month:
SELECT date_purchased, SUM(order_total) FROM orders where date_purchased between “2012-08-01″ and “2012-08-31″ and order_status <> “1″ and order_status <> “9″
Posted in MySQL, Zen Cart. Comments Off
Skills on How to Show different Adsense Ads at WordPress
March 24th, 2012 — admin
More and more people love to use wordpress to setup blogs and place adsense ads, and many people still love the use the theme of Classic, by Dave Shea. Can we show different adsense code at the same place, but different pages then? For example, we want to show 2 adsense block at the main body of detailed pages, but only show 1 adsense block at other page’s main body.
Posted in Php Code, Php Skills, Php Study, WordPress. Comments Off
How to change left width 2-columns skin of x-cart v4.5?
March 22nd, 2012 — admin
For our personal needs, we may need to change the left width of 2-columns skin of x-cart. At present, most users are using X-cart Gold V4.5.
Go to skin/2-columns/css, and open altskin.css, change:
#left-bar {
width: 207px;
margin-left: 0;
}
Posted in X-Cart. Comments Off
How to Change php.ini of Dreamhost Web Hosting?
March 8th, 2012 — admin
We usually edit .htaccess to achieve our special demands when we use the web hosting from dreamhost.com. But sometimes we have to modify php.ini to get better results, for example, we often meet the following error when we import posts to wordpress, especially we import more than 7MB files.
We usually have 3 methods to resolve such issures:
1, modify .htaccess;
2, modify wp-config.php;
I have tried these 2 methods for my dreamhost web hosting, failed.
The last one is using Custom PHP.INI auto-installer”, download it from sxi.sabrextreme.com/dh-phpini, upzip the file, and upload dh-phpini.php to your domain’s folder and open it in a browser. An editable php.ini will be created in the domain’s cgi-bin folder in a minute.
The author has thougt very carefully, after you run the code, dh-phpini.php will be deleted automatically.
Now you can edit php.ini under cgi-bin folder, for example, you can modify upload_max_filesize = 20M
to upload_max_filesize = 100M.
Posted in Web Hosting. Comments Off
« Older posts « Show Latest Testimonals at Zen-Cart Homepage
How to change left width 2-columns skin of x-cart v4.5? »