Search

The information on this page; http://getsymphony.com/learn/concepts/view/extension-file-structure/

..says.. "The files in the content directory are autoincluded and used to render back-end pages. The file content.sample.php would render a page at /symphony/extension/yourextension/sample. content.index.php is viewable at /symphony/extension/yourextension."

What if I want to pass a param to my autoincluded page in the same fashion as the symphony core does it.. for example; "/symphony/extension/yourextension/edit/2" resolving to content.edit.php with the param of 2?

I realize I can just use the url "/symphony/extension/yourextension/edit/?id=2" and get my params for $_GET, but I would like to do it the say way the as the symphony cms does.

Hope this all makes sense.

Any direction on the best way to achieve this would be great.

I too have been struggling with this recently as I work on my first extension to use content pages. Nick Dunn gave a cogent explanation in my inquiry about this, which I did not yet thank him for (thanks, Nick!).

I’m still feeling things out, and I’m not really certain what I’m doing is the “best” way to go about it, but it’s working for me so far. I have not had to override the __switchboard() method yet; I’ve just used the build() method to pull parameters from the $context array as per Nick’s explanation.

Also, as with many things related to Symphony development, looking at other people’s extensions on GitHub to see how they accomplish things can be very helpful.

Good luck!

@tachyondecay thanks for your reply and sending me on to your post! I believe I have it sorted now.

Also thanks to Nick Dunn!

Does anyone know if it is possible to have;

/symphony/extension/extensionname/pagename/subpagename/foo/

go through to;

content.pagename.subpage_name.php and run __viewFoo()

@vaughanhale: in your extension.driver.php you can add a method called 'fetchNavigation' that has a specific link:

public function fetchNavigation() {
    return array(
        array('name' =>'foo', 'link' => '/pagename/subpagename/foo'),
    }
}

This would call the page content.foo.php with the link /symphony/extension/extensionname/pagename/subpagename/foo/

Would a content.foo.php file not link to "/symphony/extension/extensionname/foo/" rather than"/symphony/extension/extensionname/pagename/subpagename/foo/"?

Or are you saying that by defining the fetchNavigation function I am mapping foo to that link for when symphony looks for the page?

Hope that makes sense..

As far as I know you cannot use sub pages. So if you wanted the URL:

symphony/extension/extensionname/pagename/subpagename/foo/

This would be content.pagename.php onto which you pass two parameters subpagename and foo, available to you through the $context parameter mentioned above.

You don't need to use the fetchNavigation to register the URLs, this is just used for building the navigation within the CMS to the pages you want to expose.

You don't need to use the fetchNavigation to register the URLs, this is just used for building the navigation within the CMS to the pages you want to expose.

Ok, so I missed the part where this was only for the UI. I thought this also allowed you to register a page on that location as some sort of workaround.

Oh maybe it is?

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