librelist archives

« back to archive

progress on customizing Foafpress?

progress on customizing Foafpress?

From:
elf Pavlik
Date:
2011-09-14 @ 09:21
Hello,

I would like to ask about progress on those 3 features marked on github 
wiki as planned:

Pimp your FOAF profile (planned)
Use own Templates (planned)
Write own Resource Controllers (planned)

What do you think about putting some content describing desired 
functionality on those pages and maybe it will inspire someone to help 
with implementing them?

Cheers,
~ elf Pavlik ~

Re: [foafpress] progress on customizing Foafpress?

From:
Michael Haschke
Date:
2011-09-14 @ 11:05
Hi,

2011/9/14 elf Pavlik:

> Pimp your FOAF profile (planned)

This is just a wiki site (planned), with a lot of examples how to
combine FOAF vocabulary with other rdf vocabularies, enhanced by good
real world examples and best practices.

> Use own Templates (planned)
> Write own Resource Controllers (planned)
> What do you think about putting some content describing desired 
functionality on those pages and maybe it will inspire someone to help 
with implementing them?

It's already implemented since the beginning but until now I haven't
found time to write a wiki page on that. Maybe I just create the
stubs, because everyone with a github account can edit the wiki.

This is the outline, I think it's dead simple:

Preamble: create your 'myfoafpressextensions' folder parallel to the
'foafpressapp' folder.

# Creating own resource controllers

Create myfoafpressextensions/controllers/foaf/Group.php with

<?php

require_once './../foafpressapp/core/controllers/foaf/Group.parent.php';

class Foaf_Group_Controller extends Foaf_Group_Controller_Parent
{
   // doing stuff, create your own methods or overwrite parent methods
}

?>

Now, edit your fp-config.php, adding on the right place

$c['plugin']['folder'][] =
dirname(__FILE__).'/myfoafpressextensions/controllers/';

That's all! Same with foaf/Person.php, etc ...

It's not necessary to copy the whole controller scope, e.g. if you
don't have foaf/Person.php in your controller folder, Foafpress falls
back to its own default controller.

# Using own templates

Copy
foafpressapp/core/templates/Foafpress.html.php to
myfoafpressextensions/templates/Foafpress.html.php and
foafpressapp/core/templates/foaf/Group.html.php to
myfoafpressextensions/templates/foaf/Group.html.php

Now edit what you need to change, or create it straight new.
Foafpress.html.php defines the global layout, header, footer, and so
on. foaf/Group.html.php is the template for foaf:Group resources.

Edit your fp-config.php, adding to the right place:

$c['template']['folder'][] =
dirname(__FILE__).'/myfoafpressextensions/templates/';

Again, that's all. Like with the controllers, you don't need to
copy/create all main/subtemplates to use them. If you don't have the
template in your folder, Foafpress uses its own default templates.

If this doesn't work it must be a bug :) please report here.

The only thing what is not possible at the moment is to use own css/js
files with the default templates, then you need copy the
template/Foafpress.html.php to your own folder, make the changes, but
let Foafpress use default stuff for resource/subtemplates. I plan to
contribute a plugin to make the js/css stuff configurable.

Hope this short and compressed explanation is enough for the moment. I
will copy this to the stubs and everyone is invited to add more
details :)

regards,
Haschek

--
Portfolio: http://eye48.com/
Profile/WebID: http://michael.haschke.biz/

Re: [foafpress] progress on customizing Foafpress?

From:
elf Pavlik
Date:
2011-09-14 @ 11:41
Excerpts from Michael Haschke's message of 2011-09-14 13:05:39 +0200:
> Hi,
> 
> 2011/9/14 elf Pavlik:
> 
> > Pimp your FOAF profile (planned)
> 
> This is just a wiki site (planned), with a lot of examples how to
> combine FOAF vocabulary with other rdf vocabularies, enhanced by good
> real world examples and best practices.
> 
> > Use own Templates (planned)
> > Write own Resource Controllers (planned)
> > What do you think about putting some content describing desired 
functionality on those pages and maybe it will inspire someone to help 
with implementing them?
> 
> It's already implemented since the beginning but until now I haven't
> found time to write a wiki page on that. Maybe I just create the
> stubs, because everyone with a github account can edit the wiki.
> 
> This is the outline, I think it's dead simple:
> 
> Preamble: create your 'myfoafpressextensions' folder parallel to the
> 'foafpressapp' folder.
> 
> # Creating own resource controllers
> 
> Create myfoafpressextensions/controllers/foaf/Group.php with
> 
> <?php
> 
> require_once './../foafpressapp/core/controllers/foaf/Group.parent.php';
> 
> class Foaf_Group_Controller extends Foaf_Group_Controller_Parent
> {
>    // doing stuff, create your own methods or overwrite parent methods
> }
> 
> ?>
> 
> Now, edit your fp-config.php, adding on the right place
> 
> $c['plugin']['folder'][] =
> dirname(__FILE__).'/myfoafpressextensions/controllers/';
> 
> That's all! Same with foaf/Person.php, etc ...
> 
> It's not necessary to copy the whole controller scope, e.g. if you
> don't have foaf/Person.php in your controller folder, Foafpress falls
> back to its own default controller.
> 
> # Using own templates
> 
> Copy
> foafpressapp/core/templates/Foafpress.html.php to
> myfoafpressextensions/templates/Foafpress.html.php and
> foafpressapp/core/templates/foaf/Group.html.php to
> myfoafpressextensions/templates/foaf/Group.html.php
> 
> Now edit what you need to change, or create it straight new.
> Foafpress.html.php defines the global layout, header, footer, and so
> on. foaf/Group.html.php is the template for foaf:Group resources.
> 
> Edit your fp-config.php, adding to the right place:
> 
> $c['template']['folder'][] =
> dirname(__FILE__).'/myfoafpressextensions/templates/';
> 
> Again, that's all. Like with the controllers, you don't need to
> copy/create all main/subtemplates to use them. If you don't have the
> template in your folder, Foafpress uses its own default templates.
> 
> If this doesn't work it must be a bug :) please report here.
> 
> The only thing what is not possible at the moment is to use own css/js
> files with the default templates, then you need copy the
> template/Foafpress.html.php to your own folder, make the changes, but
> let Foafpress use default stuff for resource/subtemplates. I plan to
> contribute a plugin to make the js/css stuff configurable.
> 
> Hope this short and compressed explanation is enough for the moment. I
> will copy this to the stubs and everyone is invited to add more
> details :)
great! thanks a bunch =)

> 
> regards,
> Haschek
> 

Re: [foafpress] progress on customizing Foafpress?

From:
Michael Haschke
Date:
2011-09-14 @ 11:56
Hi,

2011/9/14 Michael Haschke:
> I will copy this to the stubs and everyone is invited to add more details :)

Done:

* https://github.com/haschek/Foafpress/wiki/DevelopTemplates
* https://github.com/haschek/Foafpress/wiki/DevelopControllers

regards,
Haschek

-- 
Portfolio: http://eye48.com/
Webprofil: http://michael.haschke.biz/