Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webprofile-jwg2024
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
webprofile-jwg2024
Commits
29a0ebf6
Commit
29a0ebf6
authored
Jan 27, 2023
by
Triyah Fatmawati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RSS new (PPM)
parent
2ea6667b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
app/Http/Controllers/RssFeedNewController.php
+18
-0
resources/views/rss/feed.new.blade.php
+31
-0
routes/web.php
+1
-0
No files found.
app/Http/Controllers/RssFeedNewController.php
0 → 100644
View file @
29a0ebf6
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Models\Webprofile\Posts
;
class
RssFeedNewController
extends
Controller
{
public
function
feed
()
{
$setting
=
webprofilesetting
();
// $posts = Posts::where('post_status', 't')->
// orderBy('post_date', 'desc')->
// limit(10)->get();
$posts
=
Posts
::
orderBy
(
'created_at'
)
->
get
();
dd
(
$setting
,
$posts
);
$data
=
response
()
->
view
(
'rss.feed'
,
compact
(
'posts'
,
'setting'
))
->
header
(
'Content-Type'
,
'application/xml'
);
return
strip_tags
(
$data
);
}
}
resources/views/rss/feed.new.blade.php
0 → 100644
View file @
29a0ebf6
<?=
'<?xml version="1.0" encoding="UTF-8"?>'
.
PHP_EOL
?>
<rss
version=
"2.0"
>
<channel>
<title>
<![CDATA[ RSS {{$setting['web_title']}}]]>
</title>
<link>
<![CDATA[ {{ url('') }}]]>
</link>
<description>
<![CDATA[ BERITA {{$setting['web_title']}} ]]>
</description>
<language>
en
</language>
<pubDate>
{{ now() }}
</pubDate>
@foreach($posts as $post)
{{--
<image>
<url>
{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $post->thumbnail }}
</url>
</image>
--}}
<item>
<title>
{{ $post->title }}
</title>
<image>
<url>
{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $post->thumbnail }}
</url>
</image>
<link>
{{ url('post/'.$post['slug'])}}
</link>
<description>
{!! strip_tags(substr(html_entity_decode($post->content,ENT_COMPAT,"UTF-8"),0 , 250)) !!}
</description>
{{--
<description>
<![CDATA[{!! $post->content !!}]]>
</description>
--}}
<category>
{{ $post->rCategory->name }}
</category>
{{--
<author>
<![CDATA[{{ $post->slug }}]]>
</author>
--}}
{{--
<guid>
{{ $post->id }}
</guid>
--}}
<pubDate>
{{ $post->post_date }}
</pubDate>
</item>
@endforeach
</channel>
</rss>
\ No newline at end of file
routes/web.php
View file @
29a0ebf6
...
@@ -22,3 +22,4 @@ Route::get('reload-captcha', 'Auth\LoginController@reloadCaptcha')->name('reload
...
@@ -22,3 +22,4 @@ Route::get('reload-captcha', 'Auth\LoginController@reloadCaptcha')->name('reload
Route
::
post
(
'/change-language'
,
'TranslateController@changeLocale'
)
->
name
(
'language'
);
Route
::
post
(
'/change-language'
,
'TranslateController@changeLocale'
)
->
name
(
'language'
);
Route
::
get
(
'/home'
,
'HomeController@index'
)
->
name
(
'home'
);
Route
::
get
(
'/home'
,
'HomeController@index'
)
->
name
(
'home'
);
Route
::
get
(
'rss'
,
'RssFeedController@feed'
);
Route
::
get
(
'rss'
,
'RssFeedController@feed'
);
Route
::
get
(
'rssnew'
,
'RssFeedNewController@feed'
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment