The following components must be installed so Pubwich can work:
SimpleXML
& cURL
extensions)Cache_Lite
library)crontab
(installed on all UNIX systems)Duplicate cfg/config.sample.php
to cfg/config.php
(optional: if you want to use a custom theme, duplicate themes/default
to themes/your_theme_name
and edit the PUBWICH_THEME
constant in cfg/config.php
to "your_theme_name
".
Edit the newly created config.php
to fill the blank spaces with your informations (API keys, usernames, site’s URL, etc.) and to modify the arguments passed to Pubwich::setServices()
. See the Services configuration section of this file.
Modify your crontab
file (by running crontab -e
) and add the following line:
*/<N> * * * * <PHP> -f <ABSOLUTE_PATH>/cron/cron.php
Then replace the following elements:
<N> | Cache expiration (in minutes) |
<PHP> | The path to PHP executable binary (usually /usr/bin/php or /usr/local/bin/php , use which php to find it) |
<ABSOLUTE_PATH> | Absolute path to Pubwich directory |
Example:
*/10 * * * * /usr/bin/php -f /home/myusername/public_html/pubwich/trunk/cron/cron.php
Change the permissions on the cache
directory to make it writeable for all ($ chmod -R 0777 cache
).
Everything should be working now (when browsing to the index.php
!).
The Pubwich
object has a setServices
method which take an array as its only parameter. Each element of this array is a column (defined by an array). Each column element is a service box (see the cfg/config.sample.php
file for more examples). The order of the boxes within the column array will be the same order used for the template. To configure a box, you must use the following syntax:
array( <service>, <variable>, <config> )
Where:
<service> | the service name ('Flickr' , 'Twitter' , etc.) |
<variable> | the box’s unique name ('photos' , 'statues' , etc.) |
<config> | an array of configuration elements |
These elements can be used in any box configuration:
title | The box’s main title |
description | The box’s short description (usually dsplayed near the title) |
total | Total of elements to show for this box |
url | Atom feed URL |
link | Main website URL |
username | Your username |
To find some informations, you will have to go to the following page, and extract the &id
and &key
query variables from the "Your alerts" link.
id | Your user id |
key | Your personal API key |
username | Your username |
key | Your API key |
userid | Your user id (you will have to use http://idgettr.com to find it easily) |
username | Your username |
row | The number of photos by row. Pubwich will add the class derniere to each end-of-row photo. |
key | Your API key (get an API key) |
username | Your username |
size | The width of the album covers |
username | Your username |
size | The width of the book covers |
url | The feed URL |
link | The website URL |
text | The text to put in the box |
id | Your user id |
username | Your username |
username | Your username |
username | Your username |
size | The width of the video thumbnails |
A theme can be customized by using the functions.php
file in the theme folder.
Each service has a default item template. For example, the default item template for Twitter is this:
<li class="clearfix"><span class="date"><a href="{%link%}">{%date%}</a></span>{%text%}</li>
However, it is possible to modify each service's item template, or even for a single instance of a service. To do so, you must edit the functions.php
file and add the following function (and replacing Service
by the actual service name):
function Service_itemTemplate() {
return '<li><a href="{%link%}">{%title%}</a></li>';
}
To only modify the item template of a particular service instance, you must add the following line (and replacing Service
by the service name, and variable
by the variable name defined in your configuration file)
function Service_variable_itemTemplate() {
return '<li><a href="{%link%}">{%title%}</a></li>';
}
The tags ({%link%}
, {%title%}
, etc.) are different for each service. To get a list of available tags for a service, you must open the service file (in lib/Services/
) and look for the populateItemTemplate
method
Each theme must specify a default box template. The default theme's one is this:
<div class="boite {%class%}" id="{%id%}">
<h2><a rel="me" href="{%url%}">{%title%}</a> <span>{%description%}</span></h2>
<div class="boite-inner">
<ul class="clearfix">
{%items%}
</ul>
</div>
</div>
You can modify this function in the theme’s functions.php
file.
It is also possible to modify a service box template with a function like this: (by replacing Service
with the service name)
function Service_boxTemplate() {
return '<div class="boite {%class%}" id="{%id%}">
<h2><a rel="me" href="{%url%}">{%title%}</a> <span>{%description%}</span></h2>
<div class="boite-inner">
<ul class="clearfix">
{%items%}
</ul>
</div>
</div>';
}
To modify the box template of a particular service instance, you can use the same method as the item templates.
class | The box class HTML attribute |
id | The box title HTML attribute |
url | The service profile URL (eg. http://www.twitter.com/remi/ ) |
title | The box title, as defined in the configuration file |
description | The box description, defined in the configuration file |
items | The items HTML code generated by Pubwich |
The tags must be used with this syntax: {%tag%}