0
게시물 제목을 HTML 제목으로 추가하려면 $ addlin-> tiitle 변수에 액세스하려고합니다. 호출 후에 정의했기 때문에이 작업을 수행 할 수 없습니다. 내가하고 싶은 것은 마지막 게시물 제목을 받고 제목에 넣고 싶습니다. 도움을 주셔서 감사합니다.PHP에서 정의 된 변수를 사용하는 경우
<?php
use Carbon\Carbon;
?>
@extends('layout.main')
@section('title',Config::get('settings.title').$addlin->title) // Here i'm trying to get title of post.
@section('body')
@if(Session::has('global'))
<h3>{{Session::get('global')}}</h3>
@else
@endif
<div class="row top-slider" id="postswrapper">
<div class="container">
<?php
$post1 = array_chunk($listpost, 3);
//dd($post1[1]);
foreach ($post1 as $post_chk)
{
?>
<div class="col-md-4 col-sm-12 col-xs-12 part-1">
<div class="row">
<?php
foreach ($post_chk as $addlin)
{
$postid = $addlin->id;
$tit = $addlin->title; // Here it is defined.
$url = $addlin->url;
$credits = $addlin->credits;
$des = $addlin->description;
$headline = $addlin->headline;
$thumbnail = $addlin->thumbnail;
$out = strlen($tit) > 50 ? substr($tit,0,50)."..." : $tit;
?>