Search

NOTE: Global Parameters Extension cannot be used in this instance since it causes errors when enabling eval. I need to output php output in a parameter.

Need help with creating a very basic extension that output parameters. Actually, I just want to create a basic extension that outputs a unix timestamp.

So I need it to run this code...

echo(getdate()[0]); which will output the unix timestamp.

I'm not 100% sure about this but I think you can just use the __addParam delegate in your extension.driver.php file, like so: -

public function __addParam($context) {
    $context['params']['timestamp'] = getdate()[0];
}

That's how I added a simple production_mode parameter to the paramater pool in my extension Production Mode - have a look at that file for the boilerplate extension stuff (you can remove the other appendPreferences and __SavePreferences) - I just copied one of the other extensions when I created that one.

Perhaps one of the more experienced extension writers can chime in with whether this is correct way to do this. Hope it helps.

EDIT: Here's a gist that I think should work obviously you'd also want to add an extension.meta.xml file as well

@firegoby - Wow!!!! Thanks you so much! This is exactly what I needed!!!! Thank you!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details