Skip to content
This repository
Browse code

Merge pull request #29 from phlipper/patch-1

add GitHub Flavored Markdown to README
  • Loading branch information...
commit 20913d1a65e6b4a5757b1157a7a47e380c113acc 2 parents 7672ba6 + 4972fdd
Michael Haschke authored

Showing 1 changed file with 47 additions and 33 deletions. Show diff stats Hide diff stats

  1. +47 33 README.mkd
80 README.mkd
Source Rendered
@@ -65,17 +65,19 @@ Service configuration
65 65 All services are configured in the `config.php` file, usually a service looks
66 66 like this:
67 67
68   - array( 'Flickr', 'photos', array(
69   - 'method' => 'FlickrUser',
70   - 'title' => 'Flick<em>r</em>',
71   - 'description' => 'latest photos',
72   - 'total' => 16,
73   - 'key' => '________',
74   - 'userid' => '________',
75   - 'username' => '__________',
76   - 'row' => 4,
77   - )
78   - ),
  68 +```php
  69 +array( 'Flickr', 'photos', array(
  70 + 'method' => 'FlickrUser',
  71 + 'title' => 'Flick<em>r</em>',
  72 + 'description' => 'latest photos',
  73 + 'total' => 16,
  74 + 'key' => '________',
  75 + 'userid' => '________',
  76 + 'username' => '__________',
  77 + 'row' => 4,
  78 + )
  79 +),
  80 +```
79 81
80 82 In this example `Flickr` is the **service name**, `photos` is the **service ID**
81 83 and the inner array is the service configuration. Some parameters can be used
@@ -118,17 +120,19 @@ Box templates control the way whole boxes are displayed. There are a few differe
118 120
119 121 Example:
120 122
121   - function boxTemplate() {
122   - return '
123   - <div class="boite {{class}}" id="{{id}}">
124   - <h2><a rel="me" href="{{{url}}}">{{{title}}}</a> <span>{{{description}}}</span></h2>
125   - <div class="boite-inner">
126   - <ul class="clearfix">
127   - {{{items}}}
128   - </ul>
129   - </div>
130   - </div>';
131   - }
  123 +```php
  124 +function boxTemplate() {
  125 + return '
  126 + <div class="boite {{class}}" id="{{id}}">
  127 + <h2><a rel="me" href="{{{url}}}">{{{title}}}</a> <span>{{{description}}}</span></h2>
  128 + <div class="boite-inner">
  129 + <ul class="clearfix">
  130 + {{{items}}}
  131 + </ul>
  132 + </div>
  133 + </div>';
  134 +}
  135 +```
132 136
133 137 ### Item templates
134 138
@@ -141,9 +145,11 @@ Item templates control the way each box item is displayed. Each service has its
141 145
142 146 Example:
143 147
144   - function Twitter_TwitterUser_itemTemplate() {
145   - return '<li class="clearfix {{#in_reply_to_screen_name}}reply{{/in_reply_to_screen_name}}"><span class="date"><a href="{{{link}}}">{{{date}}}</a></span>{{{text}}}</li>'."\n";
146   - }
  148 +```php
  149 +function Twitter_TwitterUser_itemTemplate() {
  150 + return '<li class="clearfix {{#in_reply_to_screen_name}}reply{{/in_reply_to_screen_name}}"><span class="date"><a href="{{{link}}}">{{{date}}}</a></span>{{{text}}}</li>'."\n";
  151 +}
  152 +```
147 153
148 154 There’s currently no documentation about which tag you can put between `{{{}}}` braces for which service. In the meantime, you can check a service file (located in `lib/Services/<Service>.php`) and look for the `populateItemTemplate` function.
149 155
@@ -151,22 +157,30 @@ There’s currently no documentation about which tag you can put between `{{{}}}
151 157
152 158 The column template defines how each column is rendered. You don’t have to define this template; the default used by Pubwich is this:
153 159
154   - '<div class="col{{{number}}}">{{{content}}}</div>'
  160 +```php
  161 +'<div class="col{{{number}}}">{{{content}}}</div>'
  162 +```
155 163
156 164 Where `{{{number}}}` is replaced by the column number and `{{{content}}}` is replaced by the column content (the *boxes*). For instance, you could put this in your `functions.php` file:
157 165
158   - funtion columnTemplate() {
159   - '<div class="column column-{{{number}}}"><div class="column-inner">{{{content}}}</div></div>';
160   - }
  166 +```php
  167 +funtion columnTemplate() {
  168 + '<div class="column column-{{{number}}}"><div class="column-inner">{{{content}}}</div></div>';
  169 +}
  170 +```
161 171
162 172 ### Layout templates
163 173
164 174 The layout template defines the columns layout. Again, you don’t have to define this template; the default layout used by Pubwich is this (eg. if you defined 3 columns in your `config.php` file):
165 175
166   - '{{{col1}}} {{{col2}}} {{{col3}}}'
  176 +```php
  177 +'{{{col1}}} {{{col2}}} {{{col3}}}'
  178 +```
167 179
168 180 So each column is displayed one after the other. But if you’d like to change that layout, you can use this:
169 181
170   - function layoutTemplate() {
171   - return '<div class="first-column">{{{col1}}}</div><div class="other-columns">{{{col2}}} {{{col3}}}</div>';
172   - }
  182 +```php
  183 +function layoutTemplate() {
  184 + return '<div class="first-column">{{{col1}}}</div><div class="other-columns">{{{col2}}} {{{col3}}}</div>';
  185 +}
  186 +```

0 comments on commit 20913d1

Please sign in to comment.
Something went wrong with that request. Please try again.