Ed* Posted January 28, 2007 Share Posted January 28, 2007 I have a script which need to find the path domainroot/cat from bothdomainroot/year/month/day/blogpost &domainroot/pageIf 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 More sharing options...
trq Posted January 28, 2007 Share Posted January 28, 2007 Your question is not at all clear enough. Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170873 Share on other sites More sharing options...
Ed* Posted January 28, 2007 Author Share Posted January 28, 2007 The script is included in the <head> and will be run at all pages on the domain, for example domain.com/page domain.com/year/month/day/blogpost. I need the $path to work from both of these... Or a way to rewrite the code for it to work... :-[ Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170875 Share on other sites More sharing options...
trq Posted January 28, 2007 Share Posted January 28, 2007 You need to look into the $_SERVER['DOCUMENT_ROOT'] variable. Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170876 Share on other sites More sharing options...
Ed* Posted January 28, 2007 Author Share Posted January 28, 2007 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 Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170881 Share on other sites More sharing options...
linuxdream Posted January 28, 2007 Share Posted January 28, 2007 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');?> Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170886 Share on other sites More sharing options...
Ed* Posted January 28, 2007 Author Share Posted January 28, 2007 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... Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170902 Share on other sites More sharing options...
trq Posted January 28, 2007 Share Posted January 28, 2007 There is nothing wrong with php's require [b]function[/b]. What seems to be the problem now? Your last post isn't clear. Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170903 Share on other sites More sharing options...
Ed* Posted January 28, 2007 Author Share Posted January 28, 2007 <?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 neitherno errors, but errors are showing if altering the paths to something unexisting. Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-170911 Share on other sites More sharing options...
Ed* Posted January 28, 2007 Author Share Posted January 28, 2007 No one knows? Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-171080 Share on other sites More sharing options...
Ed* Posted January 28, 2007 Author Share Posted January 28, 2007 Case closed -> echo( produced incorrect paths to the images in the end of the script, thus the images wasn't showing. 8)Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/36017-solved-path-from-rootabcd-to-rootx/#findComment-171155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.