Muaj tseeb rau ntau qhov chaw thiab blogs koj tau tuaj nyob thoob plaws xws li kev lom zem li huab lossis. Yog tias koj xav tsim cov huab zoo li ntawm koj lub vev xaib lossis blog, tom qab ntawd hauv tsab xov xwm no koj tuaj yeem nrhiav cov lus qhia txog yuav ua li cas tsim nws.
Ib tus huab tag yog ib qho sau ntawm cov cim npe lossis pawg uas feem ntau tshwm sim hauv kev tshawb, txuas thiab cov lus hais. Thiab qhov ntau zaus ib los yog lwm lo lus lossis tswv yim tshwm sim, cov duab loj dua, muaj qhov txuas me me rau cov ntsiab lus thiab cov lus no.
Cov Lus Qhia
Kauj ruam 1
Ua ntej, tsim cov npe ntawm tus khub ntawm daim ntawv: tag - tus naj npawb ntawm qhov tshwm sim. Ua qhov no, siv cov cai hauv qab no:
1. <?
2. chav kawm Cim Ntawv Cim {
3.
4. ntiag tug $ cim npe;
5.
6. tsis raug nqi $ font_size_min = 14;
7. tsis raug nqi $ font_size_step = 5;
8.
9.function _construct ($ tags) {
10.
11.shuffle ($ cim npe);
12. $ no-> kab ntawv = $ tags;
13.
14. }
15.
16.yog tus muaj nuj nqi get_tag_count ($ tag_name, $ tags) {
17.
18. $ suav = 0;
19.
20. foreach ($ cim ua $ tag) {
21. yog ($ tag == $ tag_name) {
22. $ suav ++;
23. }
24. }
25.
26. xa rov $ $;
27.
28. }
29.
30. Muaj nuj nqi ntiag tug tagscloud ($ tags) {
31.
32. $ tags_list = array ();
33.
34. foreach ($ tags li $ tag) {
35. $ tags_list [$ tag] = tus kheej:: get_tag_count ($ tag, $ tags);
36. }
37.
38. rov qab $ tags_list;
39.
40. }
41.
42. haujlwm muaj nuj nqi get_min_count ($ tags_list) {
43.
44. $ min = $ tags_list [$ this-> cim npe [0];
45.
46. foreach ($ tags_list li $ tag_count) {
47.
48. yog ($ tag_count <$ min) $ min = $ tag_count;
49.
50. }
51.
52. rov $ min;
53.
54. }
55.
56. pej xeem muaj nuj nqi get_cloud () {
57.
58. $ huab = Array ();
59.
60. $ tags_list = tus kheej:: tagscloud ($ this-> cim npe);
61. $ min_count = tus kheej:: get_min_count ($ tags_list);
62.
63. foreach ($ tags_list li $ tag => $ suav) {
64.
65. $ font_steps = $ suav - $ min_count;
66. $ font_size = $ this-> font_size_min + $ this-> font_size_step * $ font_steps;
67.
68. $ huab = ". $ Tag. ";
69. }
70.
71. xa rov $ huab;
72.
73. }
74. }
75. ?>
Kauj ruam 2
Ua haujlwm nrog tus lej zoo li no:
01. <?
02.
03. $ tags = array (04. '1111', '2222', '333', '444', 05. '5555', '666', '777', '777', 06. '333', '8888', '6666', '333', 07. '888', '000’, '989', '45455', 08. '5555', '63636', '54545', '55656'
09.);
10.
11. $ mycloud = Cim npe tshiab ($ cim npe);
12. $ tags_list = $ mycloud-> get_cloud ();
13.
14. Vim tias ($ tags_list li $ tag) {
15.echo $ tag. ' ';
16. }
17.
18. ?>
Hauv cov lej ntawm cov naj npawb, muab cov cim npe uas koj xav tau!
Kauj ruam 3
Txhawm rau tso tawm ib qho huab tag nrho raws qhov tseeb, ua cov hauv qab no. Hauv cov kev teeb tsa, teeb tsa cov tsiaj ntawv tsawg kawg nkaus uas yuav sib haum rau qhov tsawg kawg ntawm qhov tshwm sim (uas yog, ib qho tshwm sim) Siv daim font_size_min teb.
Kauj ruam 4
Teem cov font loj rau cov cim tseem tshuav raws li nram no: txhua qhov tshwm sim nce cov font los ntawm ib lub pixel. Txhawm rau ua li no, siv daim font_size_step teb.
Kauj ruam 5
Yog tias koj xav txhim kho koj cov huab tag, muab nws tso rau js tsab ntawv.
Hmoov zoo tsim koj tus kheej huab!