빨간색 부분 눌렸을떄 링크 수정법좀 알려주세요
본문
게시판의 빨간색부분을 눌렸을떄 글내용말고 딴 링크로 넘어갈수있게 만드는법좀 알려주세요 !!!
여분필드도 만들어서 글쓸때 여분필드에다가 url 넣으면 바로 딴 링크로 넘어갈수있게 만들고싶습니다
코드는 이렇습니다
1쨰 코드가 view 코드이고 2째코드가 write 입니다
라온보드입니다^^
@section('fisrt_include_css')
<link rel="alternate" type="application/rss+xml" href="{{ url('rss') }}" title="RSS Feed {{ config('rss.title') }}">
@stop
<form name="fBoardList" id="fBoardList" action="" onsubmit="return formBoardListSubmit(this);" method="post" target="move">
<input type="hidden" id='_method' name='_method' value='post' />
<input type="hidden" id='type' name='type' value='' />
<input type="hidden" id='page' name='page' value='{{ $writes->currentPage() }}' />
{{ csrf_field() }}
<div class="bd_head">
<a href="{{ route('board.index', $board->table_name) }}">{{ $board->subject }}</a>
</div>
<div class="bd_count">전체 {{ $writes->total() }}건 {{ $writes->currentPage() }}페이지</div>
<div class="bd_btn">
<ul>
@if(auth()->user() && auth()->user()->isBoardAdmin($board))
<li class="dropdown">
<a href="#" class="dropdown-toggle bd_rd_more" data-toggle="dropdown" role="button" aria-expanded="false">
<button type="" class="btn btn-danger">
<i class="fa fa-cog"></i> 관리
</button>
</a>
<ul class="dropdown-menu bd_adm" role="menu">
<li><input type="submit" value="선택삭제" onclick="document.pressed=this.value"/></li>
<li><input type="submit" value="선택복사" onclick="document.pressed=this.value"/></li>
<li><input type="submit" value="선택이동" onclick="document.pressed=this.value"/></li>
<li><a href="{{ route('admin.boards.edit', $board->table_name) }}">게시판 설정</a></li>
</ul>
</li>
@endif
<li>
@if($board->use_rss_view && $board->list_level == 1 && $board->read_level == 1)
<button type="button" class="btn btn-sir" onclick="location.href='{{ route('rss', $board->table_name) }}'">
RSS
</button>
@endif
<button type="button" class="btn btn-sir" onclick="location.href='{{ route('board.create', $board->table_name). '?'. $request->getQueryString() }}'">
<i class="fa fa-pencil"></i> 글쓰기
</button>
</li>
</ul>
</div>
@if($board->use_category == 1 )
<div class="bd_category">
<ul>
<!-- 선택된 카테고리의 class에 on 추가 -->
<li class="btn" id="all"><a href="{{ route('board.index', $board->table_name) }}">전체</a></li>
@foreach($categories as $category)
<li class="btn" id="{{ $category }}"><a href="{{ route('board.index', $board->table_name). '?category='. $category }}">{{ $category }}</a></li>
@endforeach
</ul>
</div>
@endif
<!-- 갤러리형 게시판 -->
@if(auth()->user() && auth()->user()->isBoardAdmin($board))
<input type="checkbox" name="chkAll" onclick="checkAll(this.form)"> <!-- 전체선택 -->
@endif
<div id="gry" class="row">
@forelse($writes as $write)
<div class="col-md-3 col-sm-6 col-xs-12 gry"> <!-- 한줄에 4개 배치 -->
<input type="checkbox" name="chkId[]" class="writeId" value='{{ $write->id }}'>
<div>
<div class="gry_img" style="height:{{ $board->gallery_height }}px;"> <!-- height 기본값 150px로 css처리 해둠 -->
<a href="<?php echo $list[$i]['wr_5'] ?>">
</div>
<div class="gry_info">
<p @if($board->use_category == 1 ) style="display: block;" @endif>
<span class="bd_subject">
@if($board->use_category == 1 )
<a href="{{ route('board.index', $board->table_name). '?category='. $write->ca_name }}" class="subject_cg">{{ $write->ca_name }}</a>
@endif
@if($viewParams == '')
<a href="/bbs/{{ $board->table_name }}/views/{{ $write->parent }}" class="bd_subject_title">
@if(isset($request->writeId) && $request->writeId == $write->id)
<span class="read"> {{-- 열람중 --}}
{!! clean($write->subject) !!}
</span>
@else
{!! clean($write->subject) !!}
@endif
</a>
@else
<a href="/bbs/{{ $board->table_name }}/views/{{ $write->parent }}?{{ $viewParams }}" class="bd_subject_title">
@if(isset($request->writeId) && $request->writeId == $write->id)
<span class="read"> {{-- 열람중 --}}
{!! clean($write->subject) !!}
</span>
@else
{!! clean($write->subject) !!}
@endif
@endif
{{-- 글올린시간 + 설정에 있는 신규 글 시간 > 현재 시간 --}}
@if(date($write->created_at->addHours(24)) > date("Y-m-d H:i:s", time()) && $board->new != 0 )
<img src="/themes/default/images/icon_new.gif"> <!-- 새글 -->
@endif
<!-- 인기글 -->
@if($write->hit >= $board->hot)
<img src="/themes/default/images/icon_hot.gif"> <!-- 인기 -->
@endif
@if($write->comment > 0)
<span class="bd_cmt">{{ $write->comment }}</span>
@endif
</span>
</p>
<div style="display: block;">
<span class="bd_nick">
@if($board->use_sideview)
@auth
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
@if(cache('config.join')->useMemberIcon && $write->iconPath)
<span class="tt_icon"><img src="{{ $write->iconPath }}" /></span> <!-- 아이콘 -->
@endif
<span class="tt_nick">{{ $write->name }}</span> <!-- 닉네임 -->
</a>
@component(getFrontSideview(), ['sideview' => 'board', 'board' => $board, 'write' => $write, 'category' => $currenctCategory])
@endcomponent
@else
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">{{ $write->name }}</a>
@component(getFrontSideview(), ['sideview' => 'board', 'board' => $board, 'write' => $write, 'category' => $currenctCategory])
@endcomponent
@endauth
@else
@if(cache('config.join')->useMemberIcon && $write->iconPath)
<span class="tt_icon"><img src="{{ $write->iconPath }}" /></span> <!-- 아이콘 -->
@endif
<span class="tt_nick">{{ $write->name }}</span>
@endif
</span>
<span><i class="fa fa-clock-o"></i>@monthAndDay($write->created_at)</span>
<span><i class="fa fa-clock-o"></i>{{ $write->hit }}</span><br>
@if($board->use_good)
<span><i class="fa fa-thumbs-up"></i>{{ $write->good }}</span>
@endif
@if($board->use_nogood)
<span><i class="fa fa-thumbs-down"></i>{{ $write->nogood }}</span>
@endif
</div>
</div>
</div>
</div>
@empty
<div class="gry_empty_table">
<span class="empty_table">
<i class="fa fa-exclamation-triangle"></i> 게시물이 없습니다.
</span>
</div>
@endforelse
</div>
</form>
<div class="bd_btn">
<button type="button" class="btn btn-sir" onclick="location.href='{{ route('board.create', $board->table_name). '?'. $request->getQueryString() }}'">
<i class="fa fa-pencil"></i> 글쓰기
</button>
</div>
<div class="bd_sch">
<form method="get" action="{{ route('board.index', $board->table_name) }}" onsubmit="return searchFormSubmit(this);">
@if($currenctCategory != '')
<input type="hidden" id='category' name='category' value='{{ $currenctCategory }}' />
@endif
<label for="kind" class="sr-only">검색대상</label>
<select name="kind" id="kind">
<option value="subject" @if($kind == 'subject') selected @endif>제목</option>
<option value="content" @if($kind == 'content') selected @endif>내용</option>
<option value="subject || content" @if($kind == 'subject || content') selected @endif>제목+내용</option>
<option value="name, 0" @if($kind == 'name, 0') selected @endif>글쓴이</option>
<option value="name, 1" @if($kind == 'name, 1') selected @endif>글쓴이(코멘트 포함)</option>
</select>
<label for="keyword" class="sr-only">검색어</label>
<input type="text" name="keyword" id="keyword" value="{{ $kind != 'user_id' ? $keyword : '' }}" class="search" required>
<button type="submit" class="search-icon">
<i class="fa fa-search" aria-hidden="true"></i><span class="sr-only">검색</span>
</button>
</form>
</div>
{{-- 페이지 처리 --}}
{{ $writes->appends(Request::except('page'))->withPath('/bbs/'. $board->table_name)->links() }}
<script>
$(function(){
var category = "{{ $currenctCategory }}";
if(category != '') {
// document.getElementById(category).addClass
// $("div[id='" + category + "']'").addClass('on');
document.getElementById(category).className += ' on'
} else {
document.getElementById('all').className += ' on'
}
});
function searchFormSubmit(f) {
if(f.keyword.value.trim() == '') {
alert('검색어 : 필수 입력입니다.');
return false;
}
return true;
}
// 관리자 메뉴 폼 서브밋 전 실행되는 함수
function formBoardListSubmit(f) {
var selected_id_array = selectIdsByCheckBox(".writeId");
if(selected_id_array.length == 0) {
alert(document.pressed + '할 게시물을 한 개 이상 선택하세요.')
return false;
}
if(document.pressed == "선택복사") {
selectCopy("copy");
return;
}
if(document.pressed == "선택이동") {
selectCopy("move");
return;
}
if(document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다\n\n답변글이 있는 게시글을 선택하신 경우\n답변글도 선택하셔야 게시글이 삭제됩니다.")) {
return false;
}
f.removeAttribute("target");
f.action = '/bbs/{{ $board->table_name }}/delete/ids/' + selected_id_array;
f._method.value = 'DELETE';
}
return true;
}
// 선택한 게시물 복사 및 이동
function selectCopy(type) {
var f = document.fBoardList;
if (type == "copy") {
str = "복사";
} else {
str = "이동";
}
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.type.value = type;
f.target = "move";
f.action = "{{ route('board.list.move', $board->table_name)}}";
f.submit();
}
</script>
위 코드가 view 코드입니다
@extends("themes.". cache('config.theme')->name. ".layouts.". ($board->layout ? : 'basic'))
@section('title'){{ $board->subject }}게시판 | {{ cache("config.homepage")->title }}@endsection
@section('include_css')
<link rel="stylesheet" type="text/css" href="{{ ver_asset('themes/default/css/common.css') }}">
<link rel="stylesheet" type="text/css" href="{{ ver_asset('themes/default/css/board.css') }}">
@endsection
@section('include_script')
@include("common.tinymce")
@endsection
@section('content')
<div id="board" class="container">
@if($errors->any())
<script>
alert("{{ $errors->first() }}");
</script>
@endif
@php
$useEditor = $board->use_dhtml_editor;
$htmlUsable = $userLevel >= $board->html_level ? 1 : 0;
@endphp
@if($type=='update')
<form role="form" id="fwrite" method="post" action={{ route('board.update', ['boardId'=>$board->table_name, 'writeId'=>$write->id]) }} enctype="multipart/form-data" @if(auth()->user() && auth()->user()->isBoardAdmin($board)) onsubmit="return writeSubmit('{{ $useEditor }}', '{{ $htmlUsable }}');" @endif>
<input type="hidden" name="queryString" id="queryString" value="{{ Request::getQueryString() }}" />
{{ method_field('put') }}
@else
<form role="form" id="fwrite" method="post" action={{ route('board.store', $board->table_name) }} enctype="multipart/form-data" @if(auth()->guest() || !auth()->user()->isBoardAdmin($board)) onsubmit="return writeSubmit('{{ $useEditor }}', '{{ $htmlUsable }}');" @endif>
@endif
<input type="hidden" name="type" id="type" value="{{ $type }}" />
<input type="hidden" name="writeId" id="writeId" @if($type != 'create') value="{{ $write->id }}" @endif/>
<input type="hidden" name="uid" id="uid" value="{{ str_replace("/", "-", substr(bcrypt(date('ymdHis', time())), 10, 60)) }}" />
{{ csrf_field() }}
@php
$level = auth()->check() ? auth()->user()->level : 1;
@endphp
@if( ($type == 'create' && auth()->guest() )
|| ($type == 'update' && auth()->guest())
|| ($type == 'update' && !auth()->user()->isBoardAdmin($board) && $write->user_id != auth()->user()->id)
|| ($type == 'reply' && auth()->guest()) )
<div class="nologin">
<div class="form-group mb10 row @if($errors->get('name'))has-error @endif">
<div class="col-sm-3">
<label for="name" class="sr-only">이름</label>
<input type="text" class="form-control" id="name" name="name" placeholder="이름" @if($type == 'update') value="{{ $write->name }}"@else value="{{ old('name', '') }}" @endif required>
@foreach ($errors->get('name') as $message)
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
@endforeach
</div>
</div>
<div class="form-group mb10 row @if($errors->get('password'))has-error @endif">
<div class="col-sm-4">
<label for="password" class="sr-only">비밀번호</label>
<input type="password" class="form-control" id="password" name="password" placeholder="비밀번호" required>
@foreach ($errors->get('password') as $message)
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
@endforeach
</div>
</div>
<div class="form-group mb10 row @if($errors->get('email'))has-error @endif">
<div class="col-sm-5">
<label for="email" class="sr-only">이메일</label>
<input type="email" class="form-control" id="email" name="email" placeholder="이메일" @if($type=='update') value="{{ $write->email }}"@else value="{{ old('email', '') }}" @endif>
@foreach ($errors->get('email') as $message)
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
@endforeach
</div>
</div>
<div class="form-group mb10 row @if($errors->get('homepage'))has-error @endif">
<div class="col-sm-5">
<label for="homepage" class="sr-only">홈페이지</label>
<input type="text" class="form-control" id="homepage" name="homepage" placeholder="홈페이지" @if($type=='update') value="{{ $write->homepage }}"@else value="{{ old('email', '') }}" @endif>
@foreach ($errors->get('homepage') as $message)
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
@endforeach
</div>
</div>
</div>
@endif
@if($board->use_category)
<div class="form-group mb10 row @if($errors->get('ca_name'))has-error @endif">
<div class="col-sm-3">
<select class="form-control" id="ca_name" name="ca_name" required>
<option value>분류</option>
@foreach($categories as $category)
<option value="{{ $category }}" @if( ($type != 'create' && $category == $write->ca_name) || ($type == 'create' && ($category == $currenctCategory || $category == old('ca_name')) ) ) selected @endif>
{{ $category }}
</option>
@endforeach
@if(!is_int(array_search('공지', $categories)) && auth()->user() && auth()->user()->isBoardAdmin($board))
<option value="공지">공지</option>
@endif
</select>
</div>
@foreach ($errors->get('ca_name') as $message)
<div>
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
</div>
@endforeach
</div>
@endif
<div class="row">
<div class="form-group mb10 col-sm-8 @if($errors->get('subject'))has-error @endif">
<label for="" class="sr-only">게시물 작성</label>
<input type="text" class="form-control" id="subject" name="subject" placeholder="게시물 제목" @if($type == 'create') value="{{ old('subject') }}"@else value="{{ $write->subject }}" @endif required>
@foreach ($errors->get('subject') as $message)
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
@endforeach
</div>
@auth
<script src="{{ ver_asset('js/autosave.js') }}"></script>
<div class="bd-save col-xs-4 dropdown">
<a href="#" id="autosaveBtn" class="dropdown-toggle btn btn-sir" data-toggle="dropdown" role="button" aria-expanded="false">
<i class="fa fa-archive"></i>
<span style="margin-left: 5px" id="autosaveCount">({{ $autosaveCount }})</span>
</a>
<ul class="dropdown-menu" role="menu" id="autosavePop"></ul>
</div>
@endauth
</div>
@if($board->use_dhtml_editor && $userLevel >= $board->html_level)
<div style="border: 1px solid #ccc; background: #fff; min-height: 400px; border-radius: 4px; box-sizing: border-box; margin-bottom: 10px;" @if($errors->get('content')) class="has-error" @endif>
<textarea class="editorArea" name="content" id="content">@if($type == 'update'){{ convertText($write->content, 0) }}@else{{ old('content', '') }}@endif</textarea>
</div>
@else
@if(auth()->guest() || !auth()->user()->isSuperAdmin())
@if($board->write_min || $board->write_max)
<p id="charCountDesc">이 게시판은 최소 <strong>{{ $board->write_min }}</strong>글자 이상, 최대 <strong>{{ $board->write_max }}</strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
@endif
@endif
<div style="border: 1px solid #ccc; background: #fff; min-height: 400px; border-radius: 4px; box-sizing: border-box; margin-bottom: 10px; padding: 2px;" @if($errors->get('content')) class="has-error" @endif>
<textarea name="content" id="content" maxlength="65536" style="width:100%; min-height:400px; border:0;" required>@if($type == 'update'){{ convertText($write->content, 0) }}@else{{ old('content', '') }}@endif</textarea>
</div>
@if(auth()->guest() || !auth()->user()->isSuperAdmin())
@if($board->write_min || $board->write_max)
<div id="charCountWrap">
<span id="charCount">0</span>글자
</div>
@endif
@endif
@endif
@foreach($errors->get('content') as $message)
<p><strong style="color:#a94442;">{{ $message }}</strong></p>
@endforeach
<div class="wt_more">
<div class="add">
<div class="link">
<i class="fa fa-link"></i>
<span class="bd_title">링크추가</span>
</div>
<div class="link_list @if($errors->get('link1') || $errors->get('link2'))has-error @endif" style="display: none;">
<div class="item">
<label for="link1" class="sr-only">링크 1</label>
<input type="text" class="form-control" id="link1" name="link1" placeholder="링크 1" @if($type == 'update')value="{{ $write->link1 }}"@else value="{{ old('link1', '') }}"@endif>
</div>
<div class="item">
<label for="link2" class="sr-only">링크 2</label>
<input type="text" class="form-control" id="link2" name="link2" placeholder="링크 2" @if($type == 'update')value="{{ $write->link2 }}"@else value="{{ old('link2', '') }}"@endif>
</div>
@foreach ($errors->get('link1') as $message)
<div>
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
</div>
@endforeach
@foreach ($errors->get('link2') as $message)
<div>
<span class="help-block">
<strong>{{ $message }}</strong>
</span>
</div>
@endforeach
</div>
<div>
<input type='text' name='wr_5' value='<?=$write[wr_1]?>'>
</div>
<div class="file">
<i class="fa fa-download"></i>
<span class="bd_title">파일추가</span>
</div>
<div class="file_list" @if($type=='create' || !isset($boardFiles) || !$boardFiles) style="display: none;" @endif>
<div class="item">
<label for="attach_file" class="sr-only">파일첨부</label>
@if($type=='update')
@foreach($boardFiles as $boardFile)
<input type="file" id="attach_file{{ $loop->index }}" name="attach_file[]" placeholder="파일첨부" title="파일첨부 {{ $loop->index + 1 }} : 용량 {{ $board->upload_size }} 바이트 이하만 업로드 가능">
@if($board->use_file_content)
<input type="text" class="form-control" id="file_content" name="file_content[]" value="{{ $boardFile->content }}" title="파일 설명을 입력해 주세요." size="50" placeholder="파일 설명">
@endif
<input type="checkbox" id="{{ 'file_del'. $loop->index }}" name="file_del[{{ $loop->index }}]" value=1 />
<label for="{{ 'file_del'. $loop->index }}">{{ $boardFile->source.'('.$boardFile->filesize.') 파일 삭제' }}</label>
@endforeach
@for($i=notNullCount($boardFiles); $i<$board->upload_count; $i++)
<input type="file" id="attach_file{{ $i }}" name="attach_file[]" placeholder="파일첨부" title="파일첨부 {{ $i + 1 }} : 용량 {{ $board->upload_size }} 바이트 이하만 업로드 가능">
@if($board->use_file_content)
<input type="text" class="form-control" id="file_content" name="file_content[]" title="파일 설명을 입력해 주세요." size="50" placeholder="파일 설명">
@endif
@endfor
@else
@for($i=0; $i<$board->upload_count; $i++)
<input type="file" id="attach_file{{ $i }}" name="attach_file[]" placeholder="파일첨부" title="파일첨부 {{ $i + 1 }} : 용량 {{ $board->upload_size }} 바이트 이하만 업로드 가능">
@if($board->use_file_content)
<input type="text" class="form-control" id="file_content" name="file_content[]" title="파일 설명을 입력해 주세요." size="50" placeholder="파일 설명">
@endif
@endfor
@endif
</div>
</div>
</div>
</div>
<div class="clearfix">
<div class="pull-left">
@if(auth()->user() && auth()->user()->isBoardAdmin($board))
<label for="notice" class="checkbox-inline">
<input type="checkbox" id="notice" name="notice" value="1" @if($type=='update' && strpos($board->notice, (string)$write->id) !== false) checked @endif> 공지
</label>
@endif
@if($userLevel >= $board->html_level)
@if($board->use_dhtml_editor)
<input type="hidden" name="html" value="html1" />
@else
<label for="html" class="checkbox-inline">
<input type="checkbox" id="html" name="html" onclick="htmlAutoBr(this);" @if($type=='update') @if(strstr($write->option, 'html1')) checked value="html1" @elseif(strstr($write->option, 'html2')) checked value="html2" @endif @endif> html
</label>
@endif
@endif
@if($board->use_secret == 1 || auth()->user() && auth()->user()->isBoardAdmin($board))
<label for="secret" class="checkbox-inline">
<input type="checkbox" id="secret" name="secret" value="secret" @if($type=='update' && strpos($write->option, 'secret') !== false) checked @endif> 비밀글
</label>
@elseif($board->use_secret == 2)
<input type="hidden" name="secret" value="secret" />
@endif
@if(cache('config.email.default')->emailUse && $board->use_email && auth()->check())
<label for="mail" class="checkbox-inline">
<input type="checkbox" id="mail" name="mail" value="mail" checked> 답변메일받기
</label>
@endif
</div>
<div class="pull-right">
<button type="button" class="btn btn-sir submitBtn">작성완료</button>
<a href="{{ route("board.index", $board->table_name). (Request::getQueryString() ? '?'.Request::getQueryString() : '')}}" type="button" class="btn btn-default">취소</a>
{{ fireEvent('captchaPlace') }}
</div>
</div>
</form>
<iframe id="formTarget" name="formTarget" style="display:none"></iframe>
<form id="imageForm" action="{{ route('image.upload') }}" target="formTarget" method="post" enctype="multipart/form-data" style="width:0px;height:0;overflow:hidden">
{{ csrf_field() }}
<input type="file" name="image_file" id="image_file" onchange="$('#imageForm').submit(); this.value='';" style="display:none">
</form>
</div>
<script>
$(function() {
$(".link").click(function(){
$(".link_list").toggle();
$("#link1").focus();
});
$(".file").click(function(){
$(".file_list").toggle();
});
{{-- 글자수 제한 --}}
@if(!$board->use_dhtml_editor || $userLevel < $board->html_level)
@if(auth()->guest() || !auth()->user()->isSuperAdmin())
@if($board->write_min || $board->write_max)
$("#content").on("keyup", function() {
check_byte("content", "charCount");
});
@endif
@endif
@endif
});
</script>
@endsection
위 코드는 wirte 코드입니다
!-->!-->답변 1
https://sir.kr/qa/224117?vpage=1#answer_224121
답변 드렸었는데 해결이 안 되셨었나요?
어떤 부분에서 해결이 안 되셨는지 댓글 주시면 도와드리겠습니다.
답변을 작성하시기 전에 로그인 해주세요.