Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

access $_SERVER['PATH_INFO']


Go to End


4 Posts   3229 Views

Avatar
tom_a_sparks

Community Member, 11 Posts

22 July 2008 at 5:08pm

how do I access $_SERVER['PATH_INFO']?

I getting
Parse error: syntax error, unexpected T_ECHO in /tmp/silverstripe-cache-opt-lampp-htdocs-x3d-web/.cache.opt.lampp.htdocs.x3d-web.themes.blackcandy.templates.Page.ss on line 5

Avatar
Willr

Forum Moderator, 5523 Posts

23 July 2008 at 6:12pm

are you trying to access that from the Page.ss template file? that wouldnt work. You should be able to do something like this..

in Page.php

function Path() {
return $_SERVER['PATH_INFO'];
}

then in the template you can call

$Path

Avatar
tom_a_sparks

Community Member, 11 Posts

24 July 2008 at 3:16pm

Edited: 24/07/2008 3:18pm

Can I call another .ss file
in the php file?

the project I am doing
based on the path_info is what format I send the data as
/html/
HTML/XHML
/wml/
WML
/ajax/
XML or JSON

Avatar
Willr

Forum Moderator, 5523 Posts

24 July 2008 at 10:18pm

its a slightly different topic but yes - you can use a method called renderWith()

http://doc.silverstripe.com/doku.php?id=templates&s=renderwith#calling_templates_from_php_code