X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=doc%2Fthemes.md;h=d2e4c59be3edee9fbcaf1f3454815eecefe02868;hb=f8d2f81d817bbeb01026bb589f15336043e5597a;hp=589c882c6539f263cb7bbde016d5c1528b15d06d;hpb=a0530d1066d7268f1b1ea67bc3c254e9f9fc5ec8;p=friendica.git diff --git a/doc/themes.md b/doc/themes.md index 589c882c65..d2e4c59be3 100644 --- a/doc/themes.md +++ b/doc/themes.md @@ -6,7 +6,6 @@ To change the look of friendica you have to touch the themes. The current default theme is [Vier](https://github.com/friendica/friendica/tree/master/view/theme/vier) but there are numerous others. Have a look at [friendica-themes.com](http://friendica-themes.com) for an overview of the existing themes. In case none of them suits your needs, there are several ways to change a theme. -If you need help theming, there is a forum @[ftdevs@friendica.eu](https://friendica.eu/profile/ftdevs) where you can ask theme specific questions and present your themes. So, how to work on the UI of friendica. @@ -65,11 +64,11 @@ they will be overwritten by files in ### Theme Variations -Many themes are more *theme families* then only one theme. +Many themes are more *theme families* than only one theme. *duepunto zero* and *vier* allow easily to add new theme variation. We will go through the process of creating a new variation for *duepunto zero*. The same (well almost, some names change) procedure applies to the *vier* theme. -And similar steps are needed for *quattro* but this theme is using [lessc](http://lesscss.org/#docs) to maintain the CSS files.. +And similar steps are needed for *quattro* but this theme is using [lesscss](http://lesscss.org/#docs) to maintain the CSS files.. In @@ -88,12 +87,12 @@ The template (theme_settings.tpl) defines a formular consisting of a [select](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) pull-down which contains all aviable variants and s submit button. -See the documentation about [SMARTY3 templates](/help/snarty3-templates.md) for a summary of friendica specific blocks other then the select element. +See the documentation about [SMARTY3 templates](/help/snarty3-templates.md) for a summary of friendica specific blocks other than the select element. But we don't really need to change anything at the template itself. The template alone wont work though. You make friendica aware of its existance and tell it how to use the template file, by defining a config.php file. -It needs to define at lest the following functions +It needs to define at least the following functions * theme_content * theme_post @@ -109,17 +108,17 @@ The _post functions handle the processing of the send form, in this case they sa To make your own variation appear in the menu, all you need to do is to create a new CSS file in the deriv directoy and include it in the array in the config.php: $colorset = array( - 'default'=>t('default'), - 'greenzero'=>t('greenzero'), - 'purplezero'=>t('purplezero'), - 'easterbunny'=>t('easterbunny'), - 'darkzero'=>t('darkzero'), - 'comix'=>t('comix'), - 'slackr'=>t('slackr'), + 'default'=>L10n::t('default'), + 'greenzero'=>L10n::t('greenzero'), + 'purplezero'=>L10n::t('purplezero'), + 'easterbunny'=>L10n::t('easterbunny'), + 'darkzero'=>L10n::t('darkzero'), + 'comix'=>L10n::t('comix'), + 'slackr'=>L10n::t('slackr'), ); the 1st part of the line is the name of the CSS file (without the .css) the 2nd part is the common name of the variant. -Calling the t() function with the common name makes the string translateable. +Calling the L10n::t() function with the common name makes the string translateable. The selected 1st part will be saved in the database by the theme_post function. function theme_post(App $a){ @@ -130,7 +129,7 @@ The selected 1st part will be saved in the database by the theme_post function. // if the one specific submit button was pressed then proceed if (isset($_POST['duepuntozero-settings-submit'])){ // and save the selection key into the personal config of the user - set_pconfig(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); + PConfig::set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); } } @@ -138,9 +137,9 @@ Now that this information is set in the database, what should friendica do with For this, have a look at the theme.php file of the *duepunto zero*. There you'll find somethink alike - $colorset = get_pconfig( local_user(), 'duepuntozero','colorset'); + $colorset = PConfig::get( local_user(), 'duepuntozero','colorset'); if (!$colorset) - $colorset = get_config('duepuntozero', 'colorset'); + $colorset = Config::get('duepuntozero', 'colorset'); if ($colorset) { if ($colorset == 'greenzero') $a->page['htmlhead'] .= ''."\n"; @@ -168,11 +167,13 @@ The content of this file should be something like theme_info = array( 'extends' => 'duepuntozero'. ); - set_template_engine($a, 'smarty3'); + $a->set_template_engine('smarty3'); /* and more stuff e.g. the JavaScript function for the header */ } @@ -180,13 +181,13 @@ Next take the default.php file found in the /view direcotry and exchange the asi So the central part of the file now looks like this:
- - -