테스트 사이트 - 개발 중인 베타 버전입니다

각 페이지별 다른 이미지 불러오는 수스 좀 부탁드립니다.

· 13년 전 · 745 · 3
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
include_once("_head.php");
?>

<table width="100%" height="189" background="/imgs/sub/top_bg.png" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" >
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="/imgs/sub/sub_img1.png" width="1000" height="183" /></td>
</tr>
</table>
</td>
</tr>
</table>

---------------------------------------------------------------------------------------

위에는 이미지만 따로 넣어놓은 pnp소스고요
밑에는 각각의 페이지 마다 위에 php를 이용하여 각각의 이미지가 나올수 있도록요

[info1_1.php/info1_2.php/info1_3.php]sub_img1.png
[info2_1.php/info2_2.php/info2_3.php]sub_img2.png
[info3_1.php/info3_2.php/info3_3.php]sub_img3.png


각각의 서브 이미지가 달라진다고 생각하시면 되는데...
알려주세요

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 3개

13년 전
함수를 이용하시면 됩니다.

$currentPage = $_SERVER['PHP_SELF'];

if($currentPage=='info1_1.php' or $currentPage=='info1_3.php' ){
$img = 'sub_img1.png ';
}else if($currentPage=='info2_2.php' or $currentPage=='info2_3.php'){
$img = 'sub_img2.png ';
}else{
$img = 'sub_img3.png ';
}

<img src='<?=$img?>' />

문법이나 콤마 등이 빠졌을수 있으니 참고해서 본인이 수정하시면 될거에요.
모니터군님 땡큐합니다.
그런데요~ 이미지가 경로가 안잡히네요


<?
include_once("./_common.php");
include_once("$g4[path]/lib/info.lib.php");
include_once("_head.php");

?>

<table width="100%" height="189" background="/imgs/sub/top_bg.png" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" >
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src='<?=$img?>' /></td>
</tr>
</table>
</td>
</tr>
</table>


제가 이미지 나올 소스를 저기다가 붙쳤고요
include_once("$g4[path]/lib/info.lib.php");
여기 안에다가 주신 소스를 밑에와 같이 넣었습니다.


<?
if (!defined('_GNUBOARD_')) exit;

$currentPage = $_SERVER['PHP_SELF'];

if($currentPage=='info1_1.php' or $currentPage=='info1_4.php' ){
$img = 'imgs/sub/sub_img1.png ';
}
else if($currentPage=='info2_1.php' or $currentPage=='info2_6.php'){
$img = 'imgs/sub/sub_img2.png ';
}
else if($currentPage=='info3_1.php' or $currentPage=='info3_4.php'){
$img = 'imgs/sub/sub_img3.png ';
}
else if($currentPage=='info4_1.php'){
$img = 'imgs/sub/sub_img4.png ';
}
else if($currentPage=='info5_1.php' or $currentPage=='info5_2.php'){
$img = 'imgs/sub/sub_img5.png ';
}

?>



그랬더니 이미지는 엑박으로 뜨고 http://munchun.woobi.co.kr/info/ 저렇게 밖에 경로가 안잡히더라고요

죄송하지만 어디가 잘못됬는제 부탁드립니다.
<?
if (!defined('_GNUBOARD_')) exit;

$currentPage = $_SERVER['PHP_SELF'];

if($currentPage=="/info/info1_1.php" or $currentPage=="/info/info1_2.php" or $currentPage=="/info/info1_3.php" or $currentPage=="/info/info1_4.php" ){
$img = "/imgs/sub/sub_img1.png ";
}
else if($currentPage=="/info/info2_1.php" or $currentPage=="/info/info2_2.php" or $currentPage=="/info/info2_3.php" or $currentPage=="/info/info2_4.php" or $currentPage=="/info/info2_5.php" or $currentPage=="/info/info2_6.php" ){
$img = "/imgs/sub/sub_img2.png ";
}
else if($currentPage=="/info/info3_1.php" or $currentPage=="/info/info3_2.php" or $currentPage=="/info/info3_3.php" or $currentPage=="/info/info3_4.php"){
$img = "/imgs/sub/sub_img3.png ";
}
else if($currentPage=="/info/info4_1.php"){
$img = "/imgs/sub/sub_img4.png ";
}
else if($currentPage=="/info/info5_1.php" or $currentPage=="/info/info5_2.php"){
$img = "/imgs/sub/sub_img5.png ";
}


?>



붙치기ㅋㅋ
<img src='<?=$img?>' />



위와 같이 적용하니 되네요^^

게시글 목록

번호 제목
284508
284499
284492
284490
284484
284481
284478
284476
284474
284472
284470
284458
284457
284454
284453
284447
284446
284444
284441
284440