Search

Hi at all,

I'm trying to make an extension witch get the date like a wordpress-article from the URL.

For example you type: example.com/2011/08/31/myarticle

then the extension should fetch the date in the url, this works so far with the FrontendPrePageResolve-Delegate but after that it should save the date like 2011-08-31 in a param. But when I define the FrontendParamsResolve-Delegate it isn't calling the dalegate.

Here is my code:

public function getSubscribedDelegates(){
        return array(
            array(
                'page' => '/frontend/',
                'delegate' => 'FrontendPrePageResolve',
                'callback' => 'checkURL'
            ),array(
                'page' => '/frontend/',
                'delegate' => 'FrontendParamsResolve',
                'callback' => 'addParams'
            )
        );

Does somebody know what I am making wrong? Why doesn't the delegate call addParams?

Did you add this subscription after installing the extension? They are cached from the extension driver into the database. Try disabling and then enabling the extension again — this will rebuild the delegate subscription.

What exactly is the purpose of your extension?

If you need the date for data source filtering or inside your templates, you could use your URL parameters to build the needed dates directly, e. g. writing something like

{$year}-{$month}-{$day}

in the data source editor or

<xsl:variable name="date" select="concat($year, '-', $month, '-', $day)" />

in your template (assuming your page parameters are setup like year/month/day).

@nickdunn: Ohh yes, I did! Thank you! Now it works and it explains my problems before...

@Nils: Is it possible to split automatically an URL-Parameter? I dont't want to make an address like: /articles?year=YYY&month=MM&day=DD&name=articlename. But for me it isn't very important to have an URL like: /2011/08/31/articleName OR /2011-08-31/articleName. But I want the date first.

And at all; I want try to build my first extension before we meet us at the congress in Cologne and I thought this is a good or easy idea for beginning...

Thanks to you and I hope we see us in Cologne!

If you setup your URL parameters like so:

year/month/day/title

you will get four xsl parameters based on the your URL:

$year
$month
$day
$title

So an URL like /2011/08/31/my-fancy-article will be returned as:

$year = '2011'
$month = '08'
$day = '31'
$title = 'my-fancy-article'

See here: http://getsymphony.com/learn/concepts/view/url-parameters/

Just had this problem. Wish Symphony had better documentation :(

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