-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Themes layout support #11
Comments
Hi, |
Yes, CakePHP themes include a set of assets (css, js, others) and you can create all of your views according this theme. In a specifc theme you can use Bootstrap 4, while in other theme you can use Semantic-ui, and in another you can use Foundation. This website https://www.kenkopattofloripa.com.br and https://kenkopatto.lupahosting.com.br/ were developed with Cake using themes. Both domain use same database and CakePHP core, but domains were configured to load specific theme. |
It's an interesting idea, to be productive more quickly with the framework.
The first part does not pose any particular problems. Do you want to participate in development? or was it just a request for additional feature? |
I could participate with documentation and testing those new functionalities. Maybe I could contribute with core code, but I don't know if my skills/knowledge about framework development will attend the needs. |
In CakePHP 3, themes are build like Plugins having its own folders for assets and views and others stuff (https://book.cakephp.org/3.0/en/views/themes.html and https://book.cakephp.org/3.0/en/plugins.html#plugin-create-your-own). I guess it could work similar or, it could be more like WordPress and in View layer could be a theme folder were themes could be placed with his skeleton and views, and the framework were shipped with a default-front and default-back theme inside themes folder for out of the box installation. |
This is not a problem It would be great if you could list the expected features (use cases) of this module, to build a product backlog. I just watched the cakePHP 3 plugins ... |
I agree with simplicity. About expected features:
I guess that are some usefull features that could be implemented for themes |
If I rephrase what you said:
I find that the most difficult choice to make is the provision of themes for the developer.
I think we have to mix these two solutions, but I do not know exactly how. |
I guess that themes should be installed directly in the project by developers, as we are creating a framework, not a CMS like WordPress. In a simple way, a theme will be a set of views (on MVC), that were created in a specific path according with previous variables set in a controller to render in a specific layout presentation. |
Yes, you're right I'm starting a prototype version on https://github.com/phpMv/ubiquity/tree/theme_module , just to lay the foundations. You can contribute the way you want (commenting, coding, debugging, emitting new ideas...). |
Deal! I will be following the updates and give help were I can |
Hi gildonei,
You can then create a new project that includes the changes.
By default, 3 themes are integrated: Bootstrap, Foundation and Semantic-ui |
Hi, I will download and make some tests today.
Em seg, 18 de mar de 2019 às 22:30, jcheron <[email protected]>
escreveu:
… Hi gildonei,
if you want, you can test the addition of the Themes module by updating
the devtools:
composer global require phpmv/ubiquity-devtools:dev-themes_module
You can then create a new project that includes the changes.
Ubiquity new test-themes -a
By default, 3 themes are integrated: Bootstrap, Foundation and Semantic-ui
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#11 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABTrY3O076OpJcknnpe8QtLaWhBx7qYkks5vYD2lgaJpZM4br2AP>
.
|
Summary of the main specifications:
|
Some questions:
<?php
namespace controllers;
/**
* Controller Pessoas
**/
class Pessoas extends ControllerBase{
/**
* @activeTheme("name" => "bootstrap")
*/
public function index(){
$this->loadView('index.html');
}
/**
* @activeTheme("name" => "foundation")
*/
public function client_index(){
$this->loadView('index.html');
}
/**
* @activeTheme("name" => "custom")
*/
public function admin_index(){
$this->loadView('index.html');
}
} |
Yes
For now, you can change the theme by:
|
Couldn't make it Work.
<?php
#...
"templateEngineOptions"=>array(
"cache"=>"",
"activeTheme"=>"bootstrap"
),
<?php
#/app/controllers/Pessoas.php
namespace controllers;
use \Ubiquity\themes\ThemesManager;
/**
* Controller Pessoas
**/
class Pessoas extends ControllerBase{
/**
* Index view
*/
public function index(){
ThemesManager::setActiveTheme('custom');
$this->loadView('index.html'); // Didin't work
//$this->loadView('@activeTheme/index.html'); // Didin't work - got Fatal Error
//$this->loadView('custom/Pessoas/index.html'); // Didin't work - got Fatal Error
}
}
<!DOCTYPE html>
<html>
<head>
{% block header %}
<base href="{{config["siteUrl"]}}">
<meta charset="UTF-8">
<title>CUSTOM THEME</title>
{% endblock %}
{% block css %}
{{css_('css/style.css')}}
{{css_('css/all.min.css')}}
<!-- {{css('https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.7.4/css/mdb.min.css')}} -->
{% endblock %}
</head>
<body>
{% block head %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<span class="navbar-brand mb-0 h1">Custom theme test</span>
</div>
</nav>
{% endblock %}
{% block body %}
{% endblock %}
{% block footer %}
{% endblock %}
{% block scripts %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
{% endblock %}
</body>
</html>
<h1>Hello World!</h1> Expected Result A page with hello world content using custom theme or simply hello world Result obtained |
An improvement Using web-tools, view creations should use default theme folder or ask for a theme to save new files to save files in correct path |
you should use:
On the homepage, does the top menu allow you to switch from one framework to another? |
I tried this, and got a Fatal Error.
Yes, on the home page, it allows to change the theme, also got a notice on top of page is not a valid value for database cache this notice is because in config.php database.cache => "" instead of false, and every time I have to reload cache, it turns to empty value deleting false when I update |
yes, it's normal, I did not really expect the change of Framework at runtime. |
It worked, using code below. <?php
namespace controllers;
use \Ubiquity\themes\ThemesManager;
/**
* Controller Pessoas
**/
class Pessoas extends ControllerBase{
/**
* Index view
*/
public function index(){
ThemesManager::setActiveTheme('custom');
$this->loadView('@activeTheme/Pessoas/index.html');
}
} I guess that should not be necessary to inform view folder name /Pessoas/ to load view. I think it could be more "magic" like when you not use a theme |
and where is the |
Inside /themes/theme-name-folder/ /app/themes/custom/Pessoas/ |
so it's normal that you have to put |
How can I use the |
Currently I have not adapted this method yet for themes... |
When you have time, will you be able to test the new version of devtools? For creating a new project with bootstrap and semantic
For adding foundation in a project:
For adding a non existing theme in a project -> error
For creating a new theme in a project
For creating a new theme inheriting from bootstrap in a project
For creating a new theme inheriting from bootstrap5 in a project -> error
For creating a new controller associated with a view when there is an active theme
For creating a new action associated with a view in a controller when there is an active theme
|
Scheduled for tomorrow! |
For creating a new project with bootstrap and semantic
For adding foundation in a project:
For adding a non existing theme in a project -> error
For creating a new theme in a project
For creating a new theme inheriting from bootstrap in a project
For creating a new theme inheriting from bootstrap5 in a project -> error
For creating a new controller associated with a view when there is an active theme
For creating a new action associated with a view in a controller when there is an active theme
|
Thank you very much for your work! |
I fixed the errors, and implemented the theme management in the webtools. composer global require phpmv/ubiquity-devtools:dev-master A project is created by default without activated theme, I think it's easier like that. |
OK! Later I will try to implement AdminLTE - https://adminlte.io/- as a backend theme and tell you about the results. |
Great, it's a good idea, the addition of themes is indeed extensible. |
|
Summary
Theme support
Motivation
Reading the docs, I didn't found anything indicating that Ubiquity supports theme layouts, like CakePHP as a sample, Where I can have multiples themes and set the theme to be used on controller and It will render specified view with specific theme.
Compatibility with Ubiquity's philosophy
Indicate compatibility or improvements in:
Expected results
With theme support, we could develop projects and control design versions or create CMSs where users could choose his own theme to apply to his websites
Additional context
CakePHP theme support is a good refer to this feature
The text was updated successfully, but these errors were encountered: