how to check folder name then display text at specific point in content?

Hi - I don’t know php but I used to have really good code that said:

if you (the browser) are in the folder “root/juice” then display “text1.php” here at this point in the content
if you’re in the folder “root/blend” then display “text2.php”
etc.

At a specific point in the content, it checks what folder you’re in, then displays unique text there.

All folders are 2nd level one down from root.

please does anyone know how to do this?

I already have at the top of each page a check to see which folder it’s in relative to root (with blank file root.php in root):

[php]<?php
if (file_exists("./root.php")) {
$rpath = “.”;}
else {
$rpath = “…”; }
include("$rpath/1cde/header.php");
?>[/php]

But this time I need the php to say “if you’re in the folder /juice right now, then add this text here at this point in the content.”

thanks! Val

Seems strange to do this actually. I can’t see a reason to do it in a production environment, which makes me lean towards a homework assignment?

Sponsor our Newsletter | Privacy Policy | Terms of Service