2 users online. Create an account or sign in to join them.Users

Search

I'm playing with custom data sources and try to get the page types of the current page. How do I get this data in a data source? There should be a variable available with at least the $current-page, shouldn't it?

Thanks for help, Nils

in your DS try this:

print_r($this->_env);
die();

That should give you a look at the class environment variables. Something like $this->_env['params']['current-page'] would do it I think.

Thanks, Alistair!

This is kind of crazy: That was the first thing I did yesterday and I got an empty array as result. I tried again this morning and now it's working. I'm not sure what I did wrong, maybe the server took a break due to the warm weather here ;o)

Question:
Do I have to reassociate data sources with pages when changing the code of a data source?

Nils

I'm not sure what I did wrong, maybe the server took a break due to the warm weather here ;o)

haha. Quite possible. Likely just a misspelt index though. The API has been cleaned up considerably for RC1. E.G. instead of $this->_env['params']['current-page'] you will be able to do self::environmentLookup('current-page') or self::$Environment->{"current-page"} from within a DS, or Frontend::instance()->$Register->{"current-page"} from anywhere! (provided you are in the scope of the frontend.

Do I have to reassociate data sources with pages when changing the code of a data source?

So long as you didn't change the classname/filename you shouldn't need to.

Thanks Alistair! I'm looking forward to RC1 ...

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details