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.

Archive

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

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

access $_SERVER['PATH_INFO']


Reply

4 Posts   2412 Views

Avatar
tom_a_sparks

22 July 2008 at 5:08pm Community Member, 11 Posts

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

23 July 2008 at 6:12pm Forum Moderator, 5511 Posts

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

24 July 2008 at 3:16pm (Last edited: 24 July 2008 3:18pm), Community Member, 11 Posts

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

24 July 2008 at 10:18pm Forum Moderator, 5511 Posts

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