Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Components for theme
#11
I'm not quite sure that I understand the discussion, so someone may need to explain it again to me, but here are my 2 cents.

You want to have component-like functionality for themes, so that theme developers can write PHP/HTML code snippets that are called through the get_component function, or something similar.

Components are meant to be a safe way for users to define PHP code without creating PHP files haphazardly in the GetSimple installation. A theme developer is already able to define PHP files of their own, safely within their own theme's folder, and the Edit Theme section already provides an interface for editing these files.

So, a theme developer could make a components/ folder in their theme (and an .htaccess file to prevent direct access to the folder contents), and define a file for each "component" that they want (and these "components" will be edited from Edit Theme rather than Components). Then they could define a short function get_theme_component:

PHP Code:
function get_theme_component($name) {
 
 if (file_exists($file GSTHEMESPATH $GLOBALS['TEMPLATE'] . '/components/' $name '.php')) {
 
   include($file);
 
 } else {
 
   get_component($name);
 
 }


so that get_theme_component first checks if a theme-specific "component" is defined and uses that, and otherwise just gets the corresponding user-defined component. Unless I'm gravely mistaken, there isn't a need to save the theme components as XML files, or to merge them into the XML data structure of the components.xml file.
Reply


Messages In This Thread
Components for theme - by Oleg06 - 2016-03-07, 00:40:39
RE: Components for theme - by shawn_a - 2016-03-07, 03:33:37
RE: Components for theme - by shawn_a - 2016-03-07, 03:40:17
RE: Components for theme - by Oleg06 - 2016-03-07, 04:09:17
RE: Components for theme - by shawn_a - 2016-03-07, 05:40:15
RE: Components for theme - by Oleg06 - 2016-03-07, 06:41:16
RE: Components for theme - by datiswous - 2016-03-07, 23:50:27
RE: Components for theme - by shawn_a - 2016-03-08, 23:07:22
RE: Components for theme - by datiswous - 2016-03-09, 03:16:31
RE: Components for theme - by shawn_a - 2016-03-11, 13:03:01
RE: Components for theme - by lokothodida - 2016-03-26, 21:49:11
RE: Components for theme - by DimaYakovlev - 2016-03-26, 23:48:54
RE: Components for theme - by Oleg06 - 2016-03-26, 23:01:13
RE: Components for theme - by shawn_a - 2016-03-27, 01:52:12
RE: Components for theme - by lokothodida - 2016-03-27, 10:32:49
RE: Components for theme - by shawn_a - 2016-03-27, 10:57:48
RE: Components for theme - by shawn_a - 2016-03-27, 11:04:02
RE: Components for theme - by lokothodida - 2016-03-27, 19:48:07
RE: Components for theme - by shawn_a - 2016-03-28, 00:04:23



Users browsing this thread: 1 Guest(s)