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   2443 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, 5513 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, 5513 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