×
ecommercecms.org

How to create a theme for ecommercecms.org

No comments

To create a theme for ecommercecms.org it's very it's nothing out of the box, it's the same laravel programming.

The theme are located in platform/Themes/.

1)Copy and paste the the standart theme from platform/Themes/ and rename it with your theme name start with upper case no space

should be platform/Themes/MyNewTheme

two important files are config.php and routes.php

folders for controllers is  platform/Themes/MyNewTheme/Controllers

folders for views it can be any folders in your theme

but keep the file  platform/Themes/MyNewTheme/default.blade.php

Now let's create a new controller call it : TestController

<?php namespace Platform\Themes\MyNewTheme\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Requests;
/**
* Test controler
*
* Controller to house all the functionality directly
*
*/

class Test extends Controller
{

  public function run(){

     $title = "Welcome";
     $text = "It's my new theme";

     return view('theme::mynewview',@compact('title','text'));
  }

}

 

IMPORTANT:

you should rename the theme namespace Platform\Themes\MyNewTheme\Controllers;

 

Let's create a view for method run

create a file platform\Themes\MyNewTheme\mynewview.blade.php

@extends('theme::default')
@section('title', _lang(@$rows->title))
@section('content')
     {!! @$text !!}
@stop

 

Second let's create root for this controller

open the file platform/Themes/MyNewTheme/root.php from your theme

// front end routes
Route::group(['middleware' => 'web', 'namespace' => 'Platform\Themes\MyNewTheme\Controllers'], function() {
   Route::get('/just-test-result', 'Test@run');
});

//admin routes
Route::group(['middleware' => ['CheckRole'], 'roles' =>'admin', 'namespace' => 'Platform\Themes\MyNewTheme\Controllers'], function () {

});

IMPORTANT

'namespace' => 'Platform\Themes\MyNewTheme\Controllers'  - namespace should be the path to your theme name  Platform\Themes\MyNewTheme\Controllers

 

that's it