Jump to content

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


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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.