½ÃÀÛÆäÀÌÁö·Î Áñ°Üã±âÃß°¡
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ l Ã⼮üũ l ¸¶ÀÌÆäÀÌÁö l CGIMALL
ÀÚ·á½Ç »çÀÌÆ®µî·Ï ·©Å·100 ÇÁ·Î±×·¥¸®ºä °ü¸®ÀÚÃßõÀÚ·á Ãʺ¸°¡À̵å
Ä¿¹Â´ÏƼ
Àüü ÆîÃ帱â
Äü¸Þ´º¸µÅ© jquery , CSS , PHP , Javascript , ¹«·áÆùÆ® , ASP
»ó¼¼°Ë»ö
Ȩ > Ä¿¹Â´ÏƼ > °ñµåÆÁ »ó¼¼º¸±â
Ä¿¹Â´ÏƼ ±¸Àα¸Á÷
»çÀÌÆ®µî·Ï
Ŭ¶ó¿ìµåű×
Javascript
PHP
ASP
CSS
HTML
MYSQL
jquery
image
Mobile
API
slide
°Ô½ÃÆÇ
¸Þ´º
ÇöÀçÁ¢¼ÓÀÚ ¸í »õ·Î°íħ
°Ô½ÃÆÇŸÀÌƲ °ñµåÆÁ / »ó¼¼º¸±â
Æ®À§ÅÍ·Î º¸³»±â
Ãßõ¼ö 664 | Á¶È¸¼ö 27,584 | µî·ÏÀÏ 2017-08-18 14:33:15

´Ð³×ÀÓ

Melbourners Au

Á¦¸ñ

±×·ì³» ¹è³ÊµéÀ» ¸î °³ ¸ðµëÀ¸·Î ³ª´©¾î °ñ°í·ç Ãâ·ÂÇϱâ
³»¿ë
±âÁ¸ ÇØÇÇcgi ÅÛÇø´Å±״ ¹è³Ê±×·ì ³» ¹è³ÊµéÀ» ÀüºÎ ´Ù ¶ç¿ì°Å³ª ·£´ýÀ¸·Î 1°³¸¸ ¶ç¿ì°Å³ª ÇÒ »Ó
±×·ì³» ¹è³Ê Àüü¸¦ n°³ ¸ðµÒÀ¸·Î ³ª´©¾î ±ºµ¥±ºµ¥ ÀûÀýÈ÷ »Ñ¸®´Â°Ç ºÒ°¡´ÉÇß½À´Ï´Ù.
»ç½Ç»ó ¹è³ÊÁ¦¸ñÀ» ÀÌ¿ëÇؼ­ ÀÏÀÏÀÌ ¼öµ¿À¸·Î ¹èÄ¡½ÃÄÑ¾ß Çϴµ¥¿ä.
°°Àº ÀÚ¸®¿¡ ¹è³Ê±¤°í ¸¹ÀÌ À¯Ä¡ÇÏ¼Å¾ß ÇÒ °æ¿ì ºÒÆíÇßÀ» °Ì´Ï´Ù.

ÀÌ°É °³¼±ÇÑ ÇïÆÛÇÔ¼ö¸¦ ¸¸µé¾ú½À´Ï´Ù.
ÀÌ ¿ª½Ã ÇÊ¿äÇϽŠºÐÀÌ ÀÖÀ»¸® ¾øÁö¸¸ È¥ÀÚ »ðÁúÇÑ °Ô ¾Æ±î¿ö¼­ ¿Ã·Áº¾´Ï´Ù.



/**
 * ±×·ì³» ¹è³Ê Àüü¸¦ ¶ç¿ì´Â ½ºÅ©¸³Æ®.
 *
 * $groupid str ¹è³ÊµéÀÇ ±×·ì¸íÀÌ µé¾î°©´Ï´Ù. "¸ÀÁý»ó´Ü" µî
 * $mod1 int ±âº»°ª 1. ±×·ì ³» ¸ðµç ¹è³Ê¸¦ n°³ÀÇ ±×·ìÀ¸·Î ³ª´©¾î¾ß ÇÒ ¶§ ±× nÀ» ÀÔ·ÂÇÕ´Ï´Ù.
 * $mod2 int ±âº»°ª 1. ÀÌ ÇÔ¼ö°¡ n°³ÀÇ ±×·ìÀ¸·Î ³ª´¶ ±×·ìµé Áß m¹ø° ±×·ìÀÏ ¶§ ±× mÀ» ÀÔ·ÂÇÕ´Ï´Ù.
 * $wrapper_left str °¢ ¹è³ÊÀÇ ¿ÞÂÊ¿¡ Ãâ·ÂÇØ¾ß ÇÒ html ¹®ÀÚ¿­ÀÔ´Ï´Ù. <div class="banners"> µî
 * $wrapper_right str °¢ ¹è³ÊÀÇ ¿À¸¥ÂÊ¿¡ Ãâ·ÂÇØ¾ß ÇÒ html ¹®ÀÚ¿­ÀÔ´Ï´Ù. </div> µî
 */
function groupped_banners ($groupid, $mod1 = 1, $mod2 = 1, $wrapper_left = "", $wrapper_right = "") {
// ¹è³Ê¸¦ ÀúÀåÇÏ´Â Å×À̺í¸í ±Û·Î¹úÇÔ¼öÀÔ´Ï´Ù. ¼Ö·ç¼Çº°·Î ´Ù¸¦¼öÀÖÀ½
global $happy_banner_tb;

// ¹è³Ê SQLÀ» µ¹¸³´Ï´Ù.
$banners_sql = "SELECT * FROM $happy_banner_tb WHERE groupid = "$groupid" AND display = "Y" ORDER BY title ASC";
$banners = query($banners_sql);

// iterator¸¦ ¾²±â À§ÇÑ ¹è¿­À» ±»ÀÌ Çϳª »õ·Î ¸¸µé¾î¼­
$the_banner = array();

// ±× ¹è¿­¿¡ while¹®À¸·Î sql°á°ú¸¦ ¸ð¾Æ³õ°í
while ($each_banner = mysql_fetch_assoc($banners)) : $the_banner[] = $each_banner; endwhile;

// ¹è³Ê¸¦ n°³ÀÇ ±×·ìÀ¸·Î ³ª´¯´Ï´Ù. µîÂ÷¼ö¿­ ¿ø¸®°¡ Àû¿ëµÇ¾î ÀÖ½À´Ï´Ù.
for ($i = 0; $i < count($the_banner); $i++) {

// m¹ø° ±×·ìÀÇ 1Ç×, 2Ç×, 3Ç×... ¸¸À» °¡Á®¿É´Ï´Ù.
$j = $mod1 * $i + $mod2;

// ½ÇÁ¦ ³ª¿Í¾ß ÇÒ ¹è³ÊÀÇ index¸¦ Á¶Á¤ÇÕ´Ï´Ù.
$k = $j - 1;

// ÀÌ index¿¡ ÇØ´çÇÏ´Â ¹è³Ê°¡ ±× ¹è¿­¿¡ ÀÖÀ¸¸é
if ($the_banner[$k]) {

// ÇÊ¿äÇÑ data¸¦ °¡Á®¿Í¼­ ¹è³Ê¸¦ »Ñ¸®°í ³¡³À´Ï´Ù.
$number = $the_banner[$k]["number"];
$width = $the_banner[$k]["width"];
$height = $the_banner[$k]["height"];
$pngClass = ( strpos($the_banner[$k]["img"],"png") )?" class="png24" ":"";

echo $wrapper_left."<a href=\"banner_link.php?number=$number\" target=\"_blank\"><img src="banner_view.php?number=$number" width=$width height=$height border=0 align="absmiddle" $linkScript $pngClass alt="$link_alt" ></a>".$wrapper_right;
}
}
}



À§ ÇÔ¼ö¸¦ inc/function.php °°Àº ÄÚ¾îÆÄÀÏ¿¡ Àû´çÈ÷ ³Ö¾î³õÀ¸½Å ´ÙÀ½ ¾Æ¹« html ÆÄÀÏ¿¡¼­³ª (¿¹¸¦ µé¾î) ÀÌ·± ½ÄÀ¸·Î ¾²½Ã¸é µË´Ï´Ù.

<?php groupped_banners("Ä¿¹Â´ÏƼùȭ¸é", 3, 1, "<div class="slide">", "</div>"); ?>
lorem

<?php groupped_banners("Ä¿¹Â´ÏƼùȭ¸é", 3, 2, "<div class="slide">", "</div>"); ?>
ipsum

<?php groupped_banners("Ä¿¹Â´ÏƼùȭ¸é", 3, 3, "<div class="slide">", "</div>"); ?>
dolor


ÀÌ·¸°Ô ÇÏ¸é ½ÇÁ¦·Î º¸ÀÌ´Â È­¸éÀº ÀÌ·¸°Ô µË´Ï´Ù.


[Ä¿¹Â´ÏƼùȭ¸é 1¹ø°¹è³Ê][Ä¿¹Â´ÏƼùȭ¸é 4¹ø°¹è³Ê][Ä¿¹Â´ÏƼùȭ¸é 7¹ø°¹è³Ê]
lorem

[Ä¿¹Â´ÏƼùȭ¸é 2¹ø°¹è³Ê][Ä¿¹Â´ÏƼùȭ¸é 5¹ø°¹è³Ê]
ipsum

[Ä¿¹Â´ÏƼùȭ¸é 3¹ø°¹è³Ê][Ä¿¹Â´ÏƼùȭ¸é 6¹ø°¹è³Ê]
dolor
Ãßõ½ºÅ©·¦¼Ò½ºº¸±â ¸ñ·Ï
IT±Õ 2018-03-21 20:10:12
´ä±Û

º¹Àâ´Ù.¤Ð¤Ð

 î¼± 2022-11-10 15:47:24
´ä±Û

ÀÌÀü°Ô½Ã±Û ÇØÇǼַç¼Ç ÅëÇÕ°Ë»ö ºÎºÐ °³¼±ÄÚµå 2017-08-11 15:05:14