Nested php includes get commented out -
i've written simple function switch languages on site.
domainname.com/minis/ regular blog
domainname.com/minis-eng/ english version
here's switcher, works alright:
<?php echo '<a href="'; if (strpos(basename(getcwd()),'eng') !== false) { $subject = basename(getcwd()); $search = '-eng'; $trimmed = str_replace($search, '', $subject); echo '/', $trimmed, '/' , basename($_server['php_self']), '">polski</a>'; } else {echo '/', basename(getcwd()), '-eng/', basename($_server['php_self']), '">english</a>';} ?>
now when place in external php , include in main index.php- works alright too. however, i'm using couple of external .php files place repeated elements. index.php looks more or less this:
- include head.php
- include body.php (this contains navigation menu)
- main content
- include footer.php
now i'd love place langswitcher.php in root directory, , place in body.php:
<?php define('root', dirname(__file__)); include (dirname(root). '/langswitcher.php'); ?>
however, apparently php including code in included .php doesn't parsed- in final result part written , commented out.
is there can make "included include" parsed?
thanks in advance , let me know if wasn't clear anywhere.
Comments
Post a Comment