Search

I have some PHP classes that I want to use from within inside an XSL template.

So I created a directory under 'workspace' called includes and I put my classes in there.

and in Home.xsl I am doing:

http://pastie.org/2753644

But I dont see what I expect PHP to do. Instead I see nothing.

Is there anything special one must do to integrate PHP functionality?

Hi jason,

An xslt template doesn't execute any php (at least not without some serious adjustments). In Symphony, you would typically add this kind of functionality as an Event, Data Source, or other extension. Incidentally, looking at your code example, I believe there is already a location extension available:

Geo Location Service

Even if that doesn't meet your specific need, you could use it as a model to integrate your classes into Symphony. For a very bare-bones version of a similar extension, you can take a look at an old extension of mine also: Datasource: IP to Location.

Hi Andrew,

I installed your extension and added it to my page and I get a MOVED in my xml

http://pastie.org/2754077

Do I have to do something else to use the extension? That is where I am fuzzy with Symphony and the use of extensions.

So looking at extensions, I could create my own to allow me to use my custom PHP code that does special things I use, correct? Am I thinking along the correct lines?

Thanks, -Jason

Andrew,

I tried using "http://ipinfodb.com/ip_query.php?ip=75.149.56.29" and indeed I get a MOVED.

So I went to the main site and you need an API Key and a few things have changed as well

http://ipinfodb.com/iplocationapi.php

so I changed this line in your extension:

public $dsParamURL = 'http://api.ipinfodb.com/v3/ip-city/?key=<api_key>';

and put in the API key I was assigned

I get an error: http://pastie.org/2754172

that I am still working on trying to resolve.

And it looks more like I would need to create a new extension now based upon the PHP example at the bottom of here: http://ipinfodb.com/iplocationapi.php

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