슬라이드 링크주소 추가 하는 태그 ??
본문
안녕 하세요
https://sir.kr/g5_builder/3006?sfl=wr_subject%7C%7Cwr_content&stx=%EC%8A%A4%EB%A7%88
위 빌더를 사용하고 있습니다
메인 슬라이더에 이미지 클릭 링크가 원래부터 없는것 같습니다
이미지 업로드 와 크기 설정 등은 관리자 에서 할수 있게 해놧는데
링크는 설정부분이 없고 링크도 안됩니다
그래서 소스파일에
이미지 링크 링크주소를 쓸수있게 추가 하려고 하는데 어떻게 해야 하는지
고수님들의 고견을 부탁 드립니다
아래는 슬라이더 파일 원본소스 입니다
감사 합니다
<?php if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가?>
<?php
$st_slider_use = $ST->theme->get('st_slider_use');
if( $st_slider_use == 1 or (!is_mobile() and $st_slider_use==2) or (is_mobile() and $st_slider_use==3) ) {
$st_slider_count = $ST->theme->get('st_slider_count');
$st_slider_bg_color = $ST->theme->get('st_slider_bg_color');
?>
<style>
#st-body .carousel-main .carousel-inner { background-color: <?=$st_slider_bg_color? $st_slider_bg_color: ''?>; }
#st-body .carousel-main .item {
height: <?=$ST->theme->get('st_slider_height_pc')?>;
background-color: <?=$st_slider_bg_color? $st_slider_bg_color: ''?>;
}
@media (max-width: 767px) {
#st-body .carousel-main .item {
height: <?=$ST->theme->get('st_slider_height_m')?>;
padding-bottom: 50%;
}
}
@media (max-width: 480px) {
#st-body .carousel-main .item {
padding-bottom: 0;
}
}
<?php if( defined('_INDEX_') and !$ST->theme->get('st_layout_main') ) { // 메인 페이지 레이아웃이 컨테이너(.container) 없음 + 전체 폭 일 때, Navbar 와의 공간 제거?>
#st-body .carousel-wrapper { margin-top: -20px; }
<?php } ?>
</style>
<section class="carousel-wrapper">
<div id="carousel-main" class="carousel carousel-main slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php for($i=0; $i<$st_slider_count; $i++) { ?>
<li data-target="#carousel-main" data-slide-to="<?=$i?>" class="<?=$i==0? 'active': ''?>"></li>
<?php } ?>
</ol>
<div class="carousel-inner" role="listbox">
<?php for($i=1; $i<=$st_slider_count; $i++) { ?>
<?php
$img_name = $ST->theme->get('st_slider_img_'.$i);
$background_image = ($img_name and file_exists($img_file = $ST->theme->get_file_path().'/'.$img_name))? 'background-image: url('.$ST->theme->get_file_url().'/'.$img_name.')': '';
if( !$background_image ) {
$st_slider_bg_img = $ST->theme->get('st_slider_bg_img');
if( $st_slider_bg_img )
$background_image = 'background-image: url('.$ST->theme->get_file_url().'/'.$st_slider_bg_img.'); background-repeat:repeat; -webkit-background-size:auto; -moz-background-size:auto; -o-background-size:auto; background-size:auto;';
}
?>
<div class="item<?=$i==1? ' active': ''?>" style="<?=$background_image?>">
<div class="carousel-caption">
<h3><?=$ST->theme->get('st_slider_title_'.$i)?></h3>
<p><?=$ST->theme->get('st_slider_desc_'.$i)?></p>
</div>
</div>
<?php } //endfor?>
</div>
<a class="left carousel-control" href="#carousel-main" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">이전</span>
</a>
<a class="right carousel-control" href="#carousel-main" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">다음</span>
</a>
</div>
</section>
<?php } ?>
답변 4
<?php for($i=1; $i<=$st_slider_count; $i++) { ?>
여기 아래를
<?php for($i=1; $i<=$st_slider_count; $i++) { ?>
<a href="<?php echo ${'link'.$i} ?>">
이렇게 링크 추가하시고
<?php } //endfor?>
여기 위에
</a>
<?php } //endfor?>
이렇게.
그리고 변수는 슬라이드 갯수만큼 생성
$link1 = '링크주소';
$link2 = '링크주소';
$link3 = '링크주소';
링크 변수는 for 바깥에 하셔야죠;;;
위 링크를 빼셨나요? 링크 빼셨으면 오류가 날 리거 없을텐데요?
어딘가 잘못하신건 아닌가요?
소스를 잘 보세요.
for 내부에서
이미지가 노출되는 오브젝트를 찾으셔서
거기에 a 태그로 감싸는 겁니다. 주소는
별도로 $link 로 선언하구요...