The structure of the theme catalog in specific5

From what I collect on the Internet and partly from documents, it is recommended to use the following structure of topics.

/css /fonts /img /includes /js /default.php /main.css /thumbnail.png /typography.css /view.php 

My questions:

  • Can main.css and typography.css be in /css ? I like that my css is neatly organized.
  • Can you use php which refer to the directory in your theme? For example, in default.php, you have something like <?php require_once echo $this->getThemePath() . "/includes/footer.html"; ?> <?php require_once echo $this->getThemePath() . "/includes/footer.html"; ?> <?php require_once echo $this->getThemePath() . "/includes/footer.html"; ?> ?
  • Does echo $this->getThemePath() correct theme folder when used in files in subdirectories (e.g. my-theme/includes/footer.php )?
+5
source share
1 answer

In short . You can structure your theme map basically the way you want. With the exception of default.php, view.php, description.txt, and thumbnail.png files. The name and location of typography.css can be changed, but I found a source for version 5.6. In version 5.7, typography.css is no longer used because the wysiwyg editor has changed. However, you can add custom styles to the new WYSIWYG editor.

Full answer
An example of a theme catalog:

 css (css folder) js (javascript folder) img (or images) elements (php files that I want to include) view.php default.php thumbnail.png description.txt 

The files thumbnail.png, description.txt, view.php (for individual pages) and default.php should be located directly in the themes directory.

On the element map, I create header.php and footer.php (but if necessary, you can put more files there, such as sidebar.php or something like that)
To reference header.php and footer.php, I put this code in default.php and view.php on the correct line:

 //version 5.6 and below $this->inc('elements/header.php'); $this->inc('elements/footer.php'); //version 5.7 and higher $view->inc('elements/header.php'); $view->inc('elements/footer.php'); 

The inc () function in specific5 was specifically created to include elements, so I prefer to use this instead of the normal include php function. The following is an example of default.php: http://pastie.org/9784547

In my header.php and / or footer.php you want to add custom css and js. For this you can use this code:

 //version 5.6 and below <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getThemePath() ?>/css/main.css" /> <?php echo '<script src="'.$this->getThemePath().'/js/concrete.js"></script>'; ?> //version 5.7 and higher <link rel="stylesheet" media="screen" type="text/css" href="<?php echo $view->getThemePath() ?>/css/main.css" /> <?php echo '<script src="'.$view->getThemePath().'/js/concrete.js"></script>'; ?> 

Header.php example: http://pastie.org/9784546

Note that typography.css is not added to header.php.

Typography.css is automatically loaded into the system, which will be used in the wysiwyg editor. To change the name and location of typography.css, you will have to override the getThemeEditorCSS () function.
This only works in version 5.6 .
Like: http://concrete5tricks.com/blog/rename-or-move-typography-css

If you are using version 5.7
Create a page-theme.php file in the root folder of your theme.
To define custom styles, add in page-theme.php:

 <?php namespace Application\Theme\Your_Theme_Name; class PageTheme extends \Concrete\Core\Page\Theme\Theme { public function getThemeEditorClasses(){ return array( array('title' => t('Title Thin'), 'menuClass' => 'title-thin', 'spanClass' => 'title-thin'), array('title' => t('Title Caps Bold'), 'menuClass' => 'title-caps-bold', 'spanClass' => 'title-caps-bold'), array('title' => t('Title Caps'), 'menuClass' => 'title-caps', 'spanClass' => 'title-caps') ); } } ?> 

(do not forget to change Your_theme_Name in the topic name + clear the cache after adding styles)
Source: http://www.concrete5.org/community/forums/5-7-discussion/adding-redactor-custom-styles-in-a-theme/

+2
source

Source: https://habr.com/ru/post/1209144/


All Articles