]> git.mxchange.org Git - friendica.git/blobdiff - doc/themes.md
Merge pull request #11516 from annando/issue-11472
[friendica.git] / doc / themes.md
index d0d74a92c6b6e2c4b32a37952ecf18c7e75ed989..7abd787e6cd31f3de867d291fa2b57dc5645a6aa 100644 (file)
@@ -3,8 +3,8 @@
 * [Home](help)
 
 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.
+The current default theme is [Vier](https://github.com/friendica/friendica/tree/stable/view/theme/vier) but there are numerous others.
+Have a look at [github.com/bkil/friendica-themes](https://github.com/bkil/friendica-themes) for an overview of the existing themes.
 In case none of them suits your needs, there are several ways to change a theme.
 
 So, how to work on the UI of friendica.
@@ -108,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'=>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'),
+        'default'=>DI::l10n()->t('default'),
+        'greenzero'=>DI::l10n()->t('greenzero'),
+        'purplezero'=>DI::l10n()->t('purplezero'),
+        'easterbunny'=>DI::l10n()->t('easterbunny'),
+        'darkzero'=>DI::l10n()->t('darkzero'),
+        'comix'=>DI::l10n()->t('comix'),
+        'slackr'=>DI::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 L10n::t() function with the common name makes the string translateable.
+Calling the DI::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){
@@ -129,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
-            PConfig::set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
+            DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
         }
     }
 
@@ -137,12 +137,12 @@ 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 = PConfig::get( local_user(), 'duepuntozero','colorset');
+        $colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
         if (!$colorset)
-            $colorset = Config::get('duepuntozero', 'colorset');
+            $colorset = DI::config()->get('duepuntozero', 'colorset');
         if ($colorset) {
             if ($colorset == 'greenzero')
-                $a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
+                DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
             /* some more variants */
         }
 
@@ -170,9 +170,8 @@ The content of this file should be something like
     use Friendica\App;
     
     function duepuntozero_lr_init(App $a) {
-        $a-> theme_info = array(
-            'extends' => 'duepuntozero'.
-        );
+        $a->setThemeInfoValue('extends', 'duepuntozero');
+
         $a->set_template_engine('smarty3');
         /* and more stuff e.g. the JavaScript function for the header */
     }
@@ -181,13 +180,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:
 
     <body>
-        <?php if(x($page,'nav')) echo $page['nav']; ?>
-        <aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></aside>
-        <section><?php if(x($page,'content')) echo $page['content']; ?>
+        <?php if(!empty($page['nav'])) echo $page['nav']; ?>
+        <aside><?php if(!empty($page['right_aside'])) echo $page['right_aside']; ?></aside>
+        <section><?php if(!empty($page['content'])) echo $page['content']; ?>
                 <div id="page-footer"></div>
         </section>
-        <right_aside><?php if(x($page,'aside')) echo $page['aside']; ?></right_aside>
-        <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>
+        <right_aside><?php if(!empty($page['aside'])) echo $page['aside']; ?></right_aside>
+        <footer><?php if(!empty($page['footer'])) echo $page['footer']; ?></footer>
     </body>
 
 Finally we need a style.css file, inheriting the definitions from the parent theme and containing out changes for the new theme.
@@ -272,16 +271,14 @@ If you like to use another templating engine, please implement it.
 
 When you want to inherit stuff from another theme you have to *announce* this in the theme_info:
 
-    $a->theme_info = array(
-      'extends' => 'duepuntozero',
-    );
+    $a->setThemeInfoValue('extends', 'duepuntozero');
 
 which declares *duepuntozero* as parent of the theme.
 
 If you want to add something to the HTML header of the theme, one way to do so is by adding it to the theme.php file.
 To do so, add something alike
 
-    $a->page['htmlhead'] .= <<< EOT
+    DI::page()['htmlhead'] .= <<< EOT
     /* stuff you want to add to the header */
     EOT;