- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
function portfolio_lists($bool, $d, $str, $ids) {
if (!isset($_GET['page']) or !is_numeric($_GET['page'])) { $page = 1; } else { $page = mysql_real_escape_string($_GET['page']); }
$write = null;
$sch_res_num = 0;
$sch = 0;
if ($bool == "personal") { $query = "SELECT * FROM `wp_posts` WHERE post_type='jh-portfolio' && post_status='publish'"; }
if ($bool == "category") { $query = "SELECT * FROM `wp_posts` WHERE post_status='publish' && post_type='jh-portfolio' &&".$ids; }
$sql = mysql_query($query) or die("Error ;)");
$num = mysql_num_rows($sql);
if ($bool == "personal") {
$sql = mysql_query($str->strake($num, $d, $page, false)); } else { $sql = mysql_query($str->strake($num, $d, $page, $ids));}
if ($num > 0) {
while ($moar = mysql_fetch_array($sql)) {
//Изображение
$img1 = mysql_fetch_row(mysql_query("SELECT * FROM `wp_postmeta` WHERE post_id='".$moar['ID']."' && meta_key='_jhp_main_image'"));
$img2 = mysql_fetch_row(mysql_query("SELECT * FROM `wp_postmeta` WHERE post_id='".$img1[3]."' && meta_key='_wp_attached_file'"));
//Категория принадлежности
$cat = mysql_query("SELECT * FROM `wp_term_relationships` WHERE object_id=".$moar['ID']) or die("Error: ".mysql_error());
if (mysql_num_rows($cat) > 0) {
$cat = mysql_fetch_array($cat);
$cat = mysql_fetch_array(mysql_query("SELECT * FROM `wp_terms` WHERE term_id=".$cat[1]));
$cat = array('id'=>$cat['term_id'], 'name'=>$cat['name']);
$im = false;
} else {
$cat = array('id'=>'', 'name'=>'Other Category');
$im = true;
}
if (strlen($img2[3]) > 0) {
$connect = explode(".", $img2[3]);
$connect = $connect[0]."-150x150.".$connect[1];
if ($im == 0) { $w = "<a href=\"http://".URL."/?page_id=20&cat_portfolio=".$cat['id']."\" class=\"category\">".$cat['name']."</a>"; }
if ($im == 1) { $w = "<font class=\"category\">".$cat['name']."</font>"; }
//Запись в переменную
$write .= "<td class=\"content_text\" ".$kr."><img src=\"http://".URL."/wp-content/uploads/".$connect."\" alt=\"\" class=\"image_portfolio\" style=\"padding-bottom: 10px;\"><br><a href=\"".$moar['guid']."\">".$moar['post_title']."</a><br>".$w."</td>";
} else {
$write .= "<td class=\"content_text\" ".$kr."><img src=\"http://".URL."/wp-content/themes/wp-framework/img/inu.png\" alt=\"Основное изображение работы не загружено\" class=\"image_portfolio\" style=\"padding-bottom: 10px;\"><br><a href=\"".$moar['guid']."\">".$moar['post_title']."</a><br>".$w."</td>";
}
$sch++;
if($sch == 3 or $sch == $sch_res_num+3) { $write .= "</tr><tr>"; $sch_res = true; $sch_res_num = $sch; } else { $sch_res = false; }
}
print($write);
if ($bool == "personal") { print("<tr><td class=\"content_text\">Go to page: ".$str->strprint("personal")."</td></tr>"); }
if ($bool == "category") { print("<tr><td class=\"content_text\">Go to page: ".$str->strprint("category")."</td></tr>"); }
if ($sch_res == false) { echo "</tr>"; }
} else { print("<td class=\"content_text\">No projects</td></tr>"); }
}
GhOsTMZ 20.02.2011 10:55 # +2
Адмирал ясенхуй?)
Sulik78 20.02.2011 11:11 # +1
... обычное студенческое говнецо, не чего интересного
Furry 21.02.2011 00:32 # 0
Int 20.02.2011 13:40 # +1
Vasiliy 20.02.2011 22:03 # +1
$cat = mysql_fetch_array(mysql_query("SELECT * FROM `wp_terms` WHERE term_id=".$cat[1]));
вот я щас ниче не понял ..........
bugmenot 20.02.2011 22:10 # +1
http://nyamo.org/svp/f5cd7ece8dce447c88228fc53edfa302.jpg
bugmenot 20.02.2011 22:23 # +2
Furry 21.02.2011 00:34 # 0
Sulik78 21.02.2011 00:43 # +1
то и необязательно делать сорок запросов в sql, а достаточно сделать один
Furry 21.02.2011 01:16 # 0
Vasiliy 21.02.2011 11:49 # 0
$red=BLUE;