W

페이지별 이미지 호출

· 2013-11-18 (월) 05:12:37 · 1927 · 8
_head.php 파일에 각 페이지별로 다른 타이틀 이미지를 호출시키는 소스를 넣고 적용하려고 하는데
테이블 id 호출 소스는

<? if ($bo_table == 'inquiry') { ?>
<img src="<?=$g4['path']?>/images/title1_1.png">
<? } ?>

이렇게 해서 적용했는데

/page/int_greeting.php
이와 같은 별도로 만들어진 파일을 인식해서 호출시키는 방법은 모르겠어요..
함수만 알면 될 것 같은데 - 프로그램 지식이 얕은지라 고수님들께 질문드려요 ㅠㅠ

새벽내내 해결이 안돼서 잠도 못자고 있어요 ㅠㅠ 도와주세요~!!

|

댓글 8개

2013-11-18 (월) 08:18:44
<? if (basenae($_SERVER['PHP_SELF'])=="int_greeting.php") { ?>
출력이미지
<? } ?>

이렇게 하시며 됩니다.
<? if (basenae($_SERVER['PHP_SELF'])=="int_greeting.php") { ?>
<img src="<?=$g4['path']?>/images/title1_1.png">
<? } ?>
<? if (basenae($_SERVER['PHP_SELF'])=="int_strategy.php") { ?>
<img src="<?=$g4['path']?>/images/title1_2.png">
<? } ?>


<? if ($bo_table == 'gallery') {// ?>
<img src="<?=$g4['path']?>/images/title5_1.png">
<? } ?>
<? if ($bo_table == 'news') {// ?>
<img src="<?=$g4['path']?>/images/title5_2.png">
<? } ?>
<? if ($bo_table == 'blog') {// ?>
<img src="<?=$g4['path']?>/images/title5_3.png">
<? } ?>
<? if ($bo_table == 'data') {// ?>
<img src="<?=$g4['path']?>/images/title5_4.png">
<? } ?>


알려주신대로 이렇게 넣어봤는데
타이틀이미지 출력부분부터 푸터까지 출력이 안되네요 ㅠ
이거 넣으니 게시판에까지 영향을 미치네요~
뭐가 문제일까요?
$fileName = getenv("SCRIPT_NAME");

위 구문은 각 파일명을 변수로 지정하는 구문인데요.

응용하면..


<?php
if ($fileName == '/page/int_greeting.php') {
?>

<img src ='이미지경로' />

<?php
else if ($fileName == '/page/다른파일.php') {
?>

<img src ='이미지경로2' />

<?php
} else {
?>

기타 다른...

<?php } ?>


저는 이렇게 씁니다. ^^;;
<?php
if ($fileName == '$g4[path]/page/int_greeting.php') {
?>
<img src="<?=$g4['path']?>/images/title1_1.png">
<? } ?>

<?php
else if ($fileName == '$g4[path]/page/int_strategy.php') {
?>
<img src="<?=$g4['path']?>/images/title1_2.png">

<?php
} else {
?>
<img src="<?=$g4['path']?>/images/title1_3.png">

<?php } ?>


<? if ($bo_table == 'gallery') {// ?>
<img src="<?=$g4['path']?>/images/title5_1.png">
<? } ?>
<? if ($bo_table == 'news') {// ?>
<img src="<?=$g4['path']?>/images/title5_2.png">
<? } ?>
<? if ($bo_table == 'blog') {// ?>
<img src="<?=$g4['path']?>/images/title5_3.png">
<? } ?>
<? if ($bo_table == 'data') {// ?>
<img src="<?=$g4['path']?>/images/title5_4.png">
<? } ?>



이렇게 넣었는데 화면이 백지상태로 나와요~ 제가 잘못넣은거 같기도 한데..
어느부분이 잘못된걸까요? ㅠㅠ
에공 죄송한데 한번만 더 여쭐께여 ㅠㅠ




<?php if ($fileName == '/page/int_greeting.php') { ?>
<img src="<?=$g4['path']?>/images/title1_1.png">

<?php } else if ($fileName == '/page/int_strategy.php') { ?>
<img src="<?=$g4['path']?>/images/title1_2.png">


<?php } else if ($fileName == '/page/menu_noodle.php') {//짬뽕 ?>
<img src="<?=$g4['path']?>/images/title2_1.png">

<?php } else if ($fileName == '/page/menu_meal.php') {//밥,요리 ?>
<img src="<?=$g4['path']?>/images/title2_3.png">


<?php } else if ($fileName == '$g4[path]/page/prc_analysis.php') {//열라성공하는법 ?>
<img src="<?=$g4['path']?>/images/title3_1.png">

<?php } else if ($fileName == '$g4[path]/page/prc_case.php') {//운영사례 ?>
<img src="<?=$g4['path']?>/images/title3_2.png">

<?php } else if ($fileName == '$g4[path]/page/prc_secret.php') {//짬뽕맛의 비밀 ?>
<img src="<?=$g4['path']?>/images/title3_3.png">

<?php } else if ($fileName == '$g4[path]/page/prc_knowhow.php') {//특급노하우 ?>
<img src="<?=$g4['path']?>/images/title3_4.png">


<?php } else if ($fileName == '$g4[path]/page/guide_competitive.php') {//경쟁력 ?>
<img src="<?=$g4['path']?>/images/title4_1.png">

<?php } else if ($fileName == '$g4[path]/page/guide_process.php') {//가맹절차 ?>
<img src="<?=$g4['path']?>/images/title4_2.png">

<?php } else if ($fileName == '$g4[path]/page/guide_expense.php') {//가맹비용 ?>
<img src="<?=$g4['path']?>/images/title4_3.png">

<?php } else if ($fileName == '$g4[path]/page/prc_knowhow.php') {//특급노하우 ?>
<img src="<?=$g4['path']?>/images/title4_4.png">

<?php } else if ($bo_table == 'inquiry') {//가맹문의 ?>
<img src="<?=$g4['path']?>/images/title4_5.png">


<?php } else if ($bo_table == 'gallery') {// ?>
<img src="<?=$g4['path']?>/images/title5_1.png">

<?php } else if ($bo_table == 'news') {// ?>
<img src="<?=$g4['path']?>/images/title5_2.png">

<?php } else if ($bo_table == 'blog') {// ?>
<img src="<?=$g4['path']?>/images/title5_3.png">

<?php } else if ($bo_table == 'data') {// ?>
<img src="<?=$g4['path']?>/images/title5_4.png">


<?php } else if ($bo_table == 'notice') {// ?>
<img src="<?=$g4['path']?>/images/title6_1.png">

<?php } else if ($bo_table == 'event') {// ?>
<img src="<?=$g4['path']?>/images/title6_2.png">

<?php } else if ($bo_table == 'qna') {// ?>
<img src="<?=$g4['path']?>/images/title6_3.png">

<?php } else { ?>
<img src="<?=$g4['path']?>/images/title1_3.png">

<?php } ?>


이렇게 넣었는데 게시판은 제대로 뜨는데 페이지는 먹히지 않고

$fileName == '$g4[path]/page/prc_secret.php' 이런식으로 넣은 부분은 전부 마지막부분

<?php } else { ?>
<img src="<?=$g4['path']?>/images/title1_3.png"> 이걸로만 뜨네여 ㅠ

아무래도 $fileName 함수가 인식이 안되는거 같아요..ㅠㅠ
$fileName = getenv("SCRIPT_NAME");

$fileName 은.. 변수입니다.. 위처럼 $fileName 이라는 변수를 지정해주셔야 하는데.. 하셨는가요?
아... 그걸 빼먹었었네요 ㅠㅠ
해결했어요 ㅋㅋ 감사합니다!!!
<?php if ($fileName == '/page/int_greeting.php') { ?>

<img src="<?=$g4['path']?>/images/title1_1.png">

<?php } else if ($fileName == '/page/int_strategy.php') { ?>

<img src="<?=$g4['path']?>/images/title1_2.png">

<?php } else if ($bo_table == 'gallery') {// ?>

<img src="<?=$g4['path']?>/images/title5_1.png">

<?php } else if ($bo_table == 'news') {// ?>

<img src="<?=$g4['path']?>/images/title5_2.png">

<?php } else if ($bo_table == 'blog') {// ?>

<img src="<?=$g4['path']?>/images/title5_3.png">

<?php } else if ($bo_table == 'data') {// ?>

<img src="<?=$g4['path']?>/images/title5_4.png">

<?php } else { ?>

<img src="<?=$g4['path']?>/images/title1_3.png">

<?php } ?>


이렇게 해보세요. ㅎ
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
13-11-18 조회 2,503
13-11-18 조회 1,821
13-11-18 조회 1,928
13-11-17 조회 1,330
13-11-17 조회 1,759
13-11-17 조회 7,693
13-11-17 조회 2,086
13-11-17 조회 1,614
13-11-17 조회 1,804
13-11-17 조회 2,308
13-11-17 조회 1,725
13-11-17 조회 2,086
13-11-17 조회 1,802
13-11-17 조회 1,366
13-11-17 조회 1,226
13-11-17 조회 2,937
13-11-17 조회 1,295
13-11-17 조회 1,314
13-11-17 조회 2,189
13-11-17 조회 1,360