Advertisement
Guest User

item

a guest
Feb 7th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. <?php
  2.  
  3. // ---- Get Random Image File
  4.  
  5. $dir = "upload/inzerat_thumb/".$item_id;
  6. $dh = opendir($dir);
  7. $fcount = 0;
  8.  
  9. while (($file = readdir($dh)) !== false) {
  10.  
  11. $pos = strpos($file, ".jpg");
  12. if($pos == true) $mozes = 1;
  13.  
  14. if($mozes > 0 AND $fcount < 6){
  15. $fcount = $fcount + 1;
  16. $adv_image = $file;
  17. }
  18. $mozes = 0;
  19. }
  20. closedir($dh);
  21.  
  22.  
  23.  
  24. // ---- Get File If Image Doesnt Exist
  25.  
  26. if($adv_image == ""){
  27. $image_url = $my_host_url."images/no_photo.png";
  28. }else{
  29. $image_url = $my_host_url."upload/inzerat_thumb/".$item_id."/".$adv_image;
  30. }
  31.  
  32.  
  33.  
  34. // ---- Generate Nice Url
  35. if($item_type == 0){
  36. $typ_inz = "ponuka";
  37. }else{
  38. $typ_inz = "dopyt";
  39. }
  40. $inz_url = $my_host_url."".$item_id."/".toNiceUrl($item_title)."/";
  41.  
  42.  
  43.  
  44. // --- Generate Price
  45. if($item_price == "0"){
  46. $item_price = "Dohodou";
  47. }else{
  48. $item_price = $item_price." CZK";
  49. }
  50.  
  51.  
  52. // --- Upravy textov -------------------------------------------------
  53. $item_title = ucfirst($item_title);
  54. $item_text = strip_tags($item_text);
  55.  
  56. $item_text2 = $item_text;
  57. $item_text = shortText($item_text2, 140);
  58. if(strlen($item_text2) > 140 ) $item_text = $item_text."...";
  59.  
  60. ?>
  61.  
  62.  
  63.  
  64. <div class="clear"></div>
  65.  
  66. <a title="<?php echo $item_title; ?>" href="<?php echo $inz_url; ?>">
  67. <img class="inzeratimg" src="<?php echo $image_url; ?>" alt="<?php echo $myrowxi["inztitle"]; ?>" />
  68. </a>
  69.  
  70. <h3>
  71. <a href="<?php echo $inz_url; ?>"><?php echo $item_title; ?></a><br />
  72. </h3>
  73.  
  74. <span class="itemtext" >
  75. <?php echo $item_text; ?>
  76. </span><br />
  77.  
  78. <span class="itemcena" >Cena: <?php echo $item_price; ?></span>
  79.  
  80. <span class="item2" >
  81. <a title="<?php echo $item_title; ?>" href="<?php echo $inz_url; ?>" class="itemlink">Zobrazit inzerát ››</a>
  82. </span>
  83.  
  84. <img class="itemciara" src="<?php echo $my_host_url; ?>images/ciara_inzerat.png" alt="" />
  85. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement