Hi i have been struggeling with this question for quite some time now.
I have some helper classes that handle images (upload an image, create
thumbnails and show a imagelist), links (add link, edit link, show
linklist), comments (add comment, show commentlist) etc.
I do not need all this functionality on every page.
Ideally I could just extend the controller like this
class Mypage extends Controlller, ImageHelper, LinkHelper{}
class AnotherPage extends Controller, CommentHelper{}
But that's not supported in php5.
Aggregate is also not supported and I dont like the beta alternatives
given on the php page.
My solution is sending the controller to the helper class so that I
have all the functions and variables in the helper classes available.
The link helper class can figure out what to do on it't own from there
and saves me lotsa time whenever I create a new set of pages.
class Mypage extends Controller(){
function _linklist(){
new LinkHelper($this);
}
public function addlink(){
new LinkHelper($this);
}
}
However this has been nagging me for quite some time now. Anyone know a
better way to do this ?
Floortje