Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Offline
Re: Show svnversion in txp:php or txp:variable
jm wrote:
Weird. What about trying
shell_exec("/usr/bin/svnversion");
?
No output.
Also, what version of PHP are you running on your devel-server? Leopard’s default?
I’m using 5.2.6, on MAMP 1.7.2.
MattD wrote:
If invoked on a directory that is not a working copy, svnversion assumes it is an exported working copy and prints "exported"
Hmm. Putting the absolute path as an argument in the command works in the Terminal:
/usr/bin/svnversion . /Users/.../sites/example.dev
But not in php:
php -r 'shell_exec("/usr/bin/svnversion . /Users/.../sites/example.dev");'
Offline
Re: Show svnversion in txp:php or txp:variable
My guess is that the dot is interpreted as “the PHP environment” (htdocs?) which could well account for the ‘exported’ output. Can you not use
"/usr/bin/svnversion /Users/.../sites/example.dev"
like that, directly? (I’ve never used the command, just speculating)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Show svnversion in txp:php or txp:variable
Should have turned on Textpattern’s debugging production status.
If I enter this in the terminal within the project directory:
php -r "echo exec(svnversion);"
I get the correct version info.
When I enter this in my template:
<txp:php>echo exec(svnversion);</txp:php>
I get this:
Tag error: <txp:php> -> Notice: Use of undefined constant svnversion - assumed 'svnversion' on line 1
textpattern/publish/taghandlers.php:3082 eval()
textpattern/publish.php:1090 php()
textpattern/publish.php:1025 processTags()
textpattern/lib/txplib_misc.php:909 parse()
textpattern/publish.php:1090 splat()
textpattern/publish.php:1012 processTags()
textpattern/lib/txplib_misc.php:1540 parse()
textpattern/publish/taghandlers.php:246 parse_form()
textpattern/publish.php:1090 output_form()
textpattern/publish.php:1012 processTags()
Entering the absolute path to svnversion results in a more terse debug message:
Parse error: syntax error, unexpected '/', expecting ')' in /path/to/textpattern/publish/taghandlers.php(3082) : eval()'d code on line 1
I should stop messing around with this! ;)
Offline
Re: Show svnversion in txp:php or txp:variable
johnstephens wrote:
Tag error: <txp:php> -> Notice: Use of undefined constant svnversion – assumed ‘svnversion’ on line 1
You must quote svnversion
(string, not constant or function).
Offline