title: PHP Script to load fonts as needed
body: <p>I'm looking for a way to add fonts on an 'as-needed' basis.</p>
  
  <p>I originally had 4 Google API Fonts chosen from when I build this particular site. Now that it's grown, I'd like to up the font selection to 9 choices.</p>
  
  <p>I'm trying to figure out a way to get this done via PHP, but I'm a designer so my php is 'eh'.</p>
  
  <p>Here's the "rough draft" from what I know of php. </p>
  
  <p>Anybody want to help me out real quick?</p>
  
  <pre><code>&lt;?php //This is in an External PHP Command Page
  $aladin = "Aladin";
  $cardo = "Cardo:400,400italic";
  $crimson = "Crimson+Text:700italic";
  $euphoria = "Euphoria+Script";
  $josefin = "Josefin+Slab:400,700";
  $philosopher = "Philosopher:400,400italic";
  $redressed = "Redressed";
  $rouge = "Rouge+Script";
  $vollkorn = "Vollkorn:400,400italic,700";
  
  //Factory Presets
  $all = "$aladin, $cardo, $crimson, $euphoria, $josefin, $philosopher, $redressed, $rouge, $vollkorn";
  $main = "$cardo, $crimson, $philosopher,";
  
      function insertFonts ($fonts) {
          echo '&lt;link href=\"//fonts.googleapis.com/css?family=';
          echo $fonts;
          echo '\' rel="stylesheet" type="text/css" /&gt;';  
          };
  ?&gt;
  </code></pre>
  
  <p>Then this in the web page.</p>
  
  <pre><code>&lt;?php //This goes inside the &lt;head&gt; of X page
  insertFonts($main); // OR insertFonts($aladin, $redressed, $euphoria); as needed
  ?&gt;
  </code></pre>
  
  <p>Also, the link tag needs a | in between the font names... I have no idea how to do this.
  The format for all of them provided by google is 
          &lt; link href='http://fonts.googleapis.com/css?family=Cardo:400,400italic|Crimson+Text:700italic|Euphoria+Script|Philosopher:400,400italic|Vollkorn:400,400italic,700|Josefin+Slab:400,700|Redressed|Aladin|Rouge+Script' rel='stylesheet' type='text/css' ></p>
  
  <p>Thanks!</p>