ramiismail / dopresskit

presskit() - spend time making games, not press.
GNU General Public License v3.0
133 stars 50 forks source link

Added Per-Project Favicon Option #17

Open doggan opened 10 years ago

doggan commented 10 years ago

Hello! Thanks for making dopresskit - it's been great.

I added an option to set the favicon per-project. I'm not sure if you'd even want to add it to the main repository, but I will share nonetheless. The patch below details the changes to sheet.php. To use it, set the XML tag "favicon-url" in the project's data.xml. If no tag is specified, it defaults to the site's root favicon. Example:

<favicon-url>http://mysite.com/myfavicon.png</favicon-url>

I've had to customize the scripts a bit for my own needs, and I have everything on a Mercurial repository on Bitbucket, so I'm not sure the best way to share this....... Will just copy the patch as-is and let someone add it if they want :P

# HG changeset patch
# User Shyam Guthikonda <shyamguth@gmail.com>
# Date 1393336529 -32400
# Node ID 98fced7e14df423b4ab5950560e985cb307af5f7
# Parent  74c6db0fe9dcd6ade862e6e333df2bafeecee82f
Allow customization of favicon per-project.

diff --git a/sheet.php b/sheet.php
--- a/sheet.php
+++ b/sheet.php
@@ -106,6 +106,9 @@
        case("website"):
            define("GAME_WEBSITE", $child);
            break;
+       case("favicon-url"):
+           define("FAVICON_URL", $child);
+           break;
        case("platforms"):
            $platforms = array();
            $i = 0;
@@ -293,6 +296,17 @@
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>'. COMPANY_TITLE .'</title>
+       
+       ';
+
+   // Set project favicon if specified.
+   if (defined("FAVICON_URL")) {
+       echo '
+       <link rel="icon" href="'. FAVICON_URL .'" type="image/x-icon" />
+       ';
+   }
+
+echo '
        <link href="http://cdnjs.cloudflare.com/ajax/libs/uikit/1.2.0/css/uikit.gradient.min.css" rel="stylesheet" type="text/css">
        <link href="style.css" rel="stylesheet" type="text/css">
    </head>