Custom templates with phpdoc2

532 views
Skip to first unread message

Ben Keen

unread,
Nov 26, 2012, 10:36:21 PM11/26/12
to phpdoc...@googlegroups.com

Howdy all.

I've been trying to get a custom template to work with PHPDocumentor (2) without much luck. What I've done is downloaded a copy of a complete template and reference it in my command, like so:

php phpdoc.php --template=/path/to/customtemplate/ -d /path/to/php/source/files -t /path/to/generated/content/

The command runs fine: it generates the documentation correctly but appears to be ignoring the --template option - at least, any changes I make to the template files in the /customtemplate folder are ignored.

Anyone have any idea?

(Thanks in advance!)

Ben

Vasil Rangelov

unread,
Nov 27, 2012, 8:16:25 AM11/27/12
to phpdoc...@googlegroups.com
Hi.
 
Currently at least, PhpDocumentor first checks to see if there's such a template its its templates folder, and if not, it copies the template from the specified folder to its templates folder ("data/templates").
 
IMHO, we should change that... Perhaps simply make PhpDocumentor not copy a template outside of its templates folder?
 
In the meantime, the way to work around this is to modify the copied template, rather than the original OR delete the copied template before reruning the project, so that your new one is again copied.

Mike van Riel

unread,
Nov 27, 2012, 8:50:34 AM11/27/12
to phpdoc...@googlegroups.com
The copying is a necessity to offer inheritance of templates; with XSL can only have literal strings in an include and as such you can never insert a location there using PHP.
As such the only solution I could think of to enable including XSL template files from other phpDocumentor templates is to copy the user's template so that he can use relative paths. Not the most elegant solution but XSL doesn't offer much choice there.


--
You received this message because you are subscribed to the Google Groups "phpDocumentor" group.
To post to this group, send an email to phpdoc...@googlegroups.com.
To unsubscribe from this group, send email to phpdocumento...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msg/phpdocumentor/-/M_k8isjWQGsJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Vasil Rangelov

unread,
Nov 27, 2012, 9:17:58 AM11/27/12
to phpdoc...@googlegroups.com
OK, then maybe have PhpDocumentor unconditionally recopy the template if the template is outside the templates folder?
 
I mean, if you have
--template=/path/to/customtemplate/
 
that would be copied to "$phpdoc/data/templates/customtemplate/", as currently, but unless you do
--template=customtemplate
 
the template will be recopied, overwriting anything previous.
 
Or perhaps instead of unconditionally recoping it, have a prompt which would either delete the old template before copying the new one, or quit transformation altogether.
Reply all
Reply to author
Forward
0 new messages