How it works:
Standalone Page Limitations:
Overview:
Standalone Integration can be used to add editable CMS content areas to existing individual pages in an application. This can be used together with, or apart from, a site with a Router Integration.
Integration:
composer require apharmony/jsharmony-cms-sdk-php
* Alternatively, the SDK can be downloaded directory from the Github jsharmony-cms-sdk-php project.
'cms' => [
"redirect_listing_path" => "jshcms_redirects.json",
"cms_server_urls" => ["https://cms.example.com/"],
"content_path" => $_SERVER['DOCUMENT_ROOT']."/path/to/published_files"
],
* Be sure to update the "content_path" property to match the CMS files publish folder in your Laravel application
use apHarmony\jsHarmonyCms\CmsRouter;
...
public function register()
{
$this->app->singleton(CmsRouter::class, function($app){
return new CmsRouter(config('app.cms'));
});
}
use apHarmony\jsHarmonyCms\CmsRouter;
...
Route::get('/path/to/standalone_page', function () {
return view('login', ['cmsPage' => app(CmsRouter::class)->getStandalone('/path/to/standalone_page')]);
});
{!! $cmsPage->editorScript !!}
<html>
<head>
@if($cmsPage->seo->title)
<title>{{ $cmsPage->seo->title }}</title>
@endif
@if($cmsPage->seo->keywords)
<meta name="keywords" content="{{ $cmsPage->seo->keywords }}" />
@endif
@if($cmsPage->seo->metadesc)
<meta name="description" content="{{ $cmsPage->seo->metadesc }}" />
@endif
@if($cmsPage->seo->canonical_url)
<link rel="canonical" href="{{ $cmsPage->seo->canonical_url }}" />
@endif
@if($cmsPage->css)
<style type="text/css">{!! $cmsPage->css !!}</style>
@endif
@if($cmsPage->js)
<script type="text/javascript">{!! $cmsPage->js !!}</script>
@endif
{!! $cmsPage->header !!}
{!! $cmsPage->editorScript !!}
</head>
<body>
<h1 cms-title>{{ $cmsPage->title }}</h1>
<div cms-content-editor="page.content.body">{!! $cmsPage->content->body !!}</div>
{!! $cmsPage->footer !!}
</body>
</html>
<!-- Page Template Config -->
<script type="text/cms-page-config">
{
"default_content": { "body": "Default Page Content" },
"properties": {
"fields": [
{ "name": "showTitle", "caption": "Show Title", "control": "checkbox", "default": "Y", "controlparams": { "value_true": "Y", "value_false": "N" } },
{ "name": "containerClass", "caption": "Container CSS Class" },
{ "name": "containerStyle", "caption": "Container CSS Style" },
]
}
}
</script>
<!-- Static Page Component -->
<div cms-component="breadcrumbs" cms-component-content="breadcrumbs">{!! $cmsPage->content->breadcrumbs !!}</div>
<!-- onRender / showIf -->
@if($cmsPage->properties->showTitle!='N')
<h1 cms-title cms-onRender="showIf(page.properties.showTitle!='N');">{{ $cmsPage->title }}</h1>
@endif
<!-- onRender / addClass -->
<div cms-onRender="addClass(page.properties.containerClass);" class="{{ $cmsPage->properties->containerClass }}"></div>
<!-- onRender / addStyle -->
<div cms-onRender="addStyle(page.properties.containerStyle);" style="{{ $cmsPage->properties->containerStyle }}"></div>
Video Tutorial: