Customising packages

Permalink
I bought a package from the marketplace and it gets me 95% to my target goal. The remainder I need to do myself through customisations.

In a similar vein to the concrete5 core, is there a proposed way that you can override packages and the code within?

I would like to do this because I would of course not want to change the files delivered from the purchased package to ensure I can benefit from upgrades etc but need to rather override in certain cases.

A specific scenario is within a Page Type template within the package. I need to change this to Use the html of my clients design.

Any tips would be gratefully received.

Regards,

Dan

dbaggs
 
Hkofoed replied on at Permalink Reply
You could create a subfolder within the block directory and name it templates. Then create your own view.php file in there. Then when in edit mode you can left click and choose your own template via 'custom template'.
dbaggs replied on at Permalink Reply
dbaggs
Thanks for your reply. Does your answer apply to Page Type's as well as indicated in my original post?

I also am keen to avoid the use of the setting of the custom template manually due to its extensive use throughout the site. Therefore, if I set this through code, it again points to modifying the Page Type template.

Any tips specifically on this aspect?

Many thanks,

Dan
ScottC replied on at Permalink Reply
ScottC
yeah

$a = new Area("whatever area name");
$a->setCustomTemplate('content','carrots');
$a->display($c);


so setCustomTemplate will look for a view.php at

blocks/content/templates/carrots/view.php and render that, sitewide for that page_type.
ScottC replied on at Permalink Reply
ScottC
and alternatively, you could search the db for bFilename and set all those in the database. if you have a block that has a bunch of custom templates, you can actually pass that into the controller save method with a field named bFilename(select type works best, obviously) and that'll be the one used.
dbaggs replied on at Permalink Reply
dbaggs
Hey Scott,

Thanks for your input. However, I am specifically looking at a challenge in a Page Type template.

The block scenario is at least resolved with the aproaches you've mentioned but it is the customisation of the Packages Page Type templates that I'm most interested in.

Any further ideas on best practice for this specific scenario?

Regards,

Dan
ScottC replied on at Permalink Reply
ScottC
instruct your users to move them to root(i think) or their theme(tested) if they want to do modifications on them and not have them overwritten with subsequent package updates.

That what you mean?
dbaggs replied on at Permalink Reply
dbaggs
Hi Scott,

Thanks for the nudges in the right direction. I didn't realise that you could override a package's Page Type template by simply creating your own file of the same name in your theme. I've just tried and it works perfectly. Quite obvious in hindsight but I guess that's the goal of others helping.

I've also overridden the controllers and models that I needed to also through the normal override approach.

I guess my confusion came from thinking that a package contents has a greater level of precedence than the root or theme.

Thanks,

Dan