Jump to content

[SOLVED] Path from 'root/a/b/c/d' to 'root/x' ?


Ed*

Recommended Posts

I have a script which need to find the path domainroot/cat from both

domainroot/year/month/day/blogpost &
domainroot/page

If I set the path to ./cat only /page will find the way - but not the other one.

How do I solve this? ???

(The script will load images from /cat)

[code]<?php getImages('./headers', 'myShow');?>
<?php function getImages($path, $galleryName) { ....................[/code]
Link to comment
https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/
Share on other sites

I tried this:

[code]<?php getImages('$_SERVER['DOCUMENT_ROOT']/domains/[domain.com]/public_html/headers', 'myShow');?>
<?php function getImages($path, $galleryName) {[/code]

Received this:

Parse error: syntax error, unexpected T_STRING in /home/[user]/domains/[domain.com]/public_html/wp-content/themes/281/header.php on line 19
This..
<?php getImages('$_SERVER['DOCUMENT_ROOT']/domains/[domain.com]/public_html/headers', 'myShow');?>

needs to look like this...

<?php getImages($_SERVER['DOCUMENT_ROOT'] . "/domains/[domain.com]/public_html/headers", 'myShow');?>
Seems like I made a bad edit of the script. The line should be something like:

<?php require $_SERVER['DOCUMENT_ROOT'] . "/mooshow/folderImages.php"; getImages($_SERVER['DOCUMENT_ROOT'] . "/headers", 'myShow');?>

Guess something is wrong in the require-command...
<?php require "./mooshow/folderImages.php"; getImages("./headers/", 'myShow');?>
works for domain.com/cat1 but not domain.com/cat1/cat2

<?php require $_SERVER['DOCUMENT_ROOT'] . "/mooshow/folderImages.php"; getImages($_SERVER['DOCUMENT_ROOT'] . "/headers/", 'myShow');?>
works for neither

no errors, but errors are showing if altering the paths to something unexisting.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.