Riseykins Posted September 24, 2008 Share Posted September 24, 2008 $path = $_SERVER["DOCUMENT_ROOT"]."/layout/"; //// Server path to layout folder If someone could explain how I find out what my DOCUMENT_ROOT is, then I'd be so happy! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/ Share on other sites More sharing options...
jonsjava Posted September 24, 2008 Share Posted September 24, 2008 a cheapskate way would be to do this: <?php print shell_exec("pwd"); ?> Not the PHP way, but it's short, and to the point. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649827 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 Why don't you just echo out $_SERVER['DOCUMENT_ROOT']? Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649828 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 How do I echo that out? *pokes siggy* Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649831 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 Uhh.. <?php echo $_SERVER['DOCUMENT_ROOT']; ?> Learn PHP before trying to code PHP. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649834 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 I'm just trying to get a script I bought to work. It didn't come with installation instructions. I'm sorta trying to learn as I try to code. Same way I learned HTML and CSS. xD Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649837 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 Go buy a PHP book or read up on starter tutorials (like on W3Schools and stuff) before you try to code in PHP, trust me. =P EDIT: Also, just contact the guy you bought it from. He should be able to get you started. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649840 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 Thanks, BTW. I did get it right in the first place, but I thought I didn't because the script STILL won't work. Ugh, what a piece of shit! Now, I get this: Warning: file(/layout/data/layoutlist.txt) [function.file]: failed to open stream: No such file or directory in /home/fabu/public_html/config.php on line 51 O.o I'm pretty angry right now, actually. Thanks for the help, guys! Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649842 Share on other sites More sharing options...
jonsjava Posted September 24, 2008 Share Posted September 24, 2008 just a hunch, but try this: $path="layout/"; Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649847 Share on other sites More sharing options...
darkfreaks Posted September 24, 2008 Share Posted September 24, 2008 server document root will not work on certain servers. i suggest use something like <?php define('WEB_ROOT','path to root folder here'); $path= WEB_ROOT . "/layout/"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649850 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 I'd bet that he doesn't know what his web root is. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649852 Share on other sites More sharing options...
darkfreaks Posted September 24, 2008 Share Posted September 24, 2008 i wouldn't doubt that LOL Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649855 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 No need to be cunts. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649858 Share on other sites More sharing options...
jonsjava Posted September 24, 2008 Share Posted September 24, 2008 it's ok, man. Some people forget to be nice, but overall, we're here to help. Do you know what a server root is? if not, I'll be more than happy to help you find out. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649860 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 No need to be cunts. I actually wasn't trying to be mean with that comment, I was being serious, because if you don't, darkfreak's comment is useless. Chill out. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649861 Share on other sites More sharing options...
wildteen88 Posted September 24, 2008 Share Posted September 24, 2008 Thanks, BTW. I did get it right in the first place, but I thought I didn't because the script STILL won't work. Ugh, what a piece of shit! Now, I get this: Warning: file(/layout/data/layoutlist.txt) [function.file]: failed to open stream: No such file or directory in /home/fabu/public_html/config.php on line 51 O.o I'm pretty angry right now, actually. Thanks for the help, guys! Don't know if any one noticed but the document root is in the error message! Try $path = "/home/fabu/public_html/layout/"; //// Server path to layout folder Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649863 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 Sorry, guys. I just thought that was kinda rude...I know I'm a n00b, here. But you don't have to deal with me if you don't want... Anyhow, I don't really know how to change things without messing the whole file up... <? /* Copyright 2007 S. Benjamin Your Membership grants you the right to use this script You may modify this script to suit your needs, but you can not resell this script You are not allowed to give this script away, or resell this script or any part of it. Unauthorized sale or redistribution of this script will result in account termination without refund, and possible legal actions! Contact info: [email protected] http://www.creativeaftermath.com */ $site_title = "EasyLayoutCMS"; //// Site title $url = "http://www.fabulayouts.com/layout/"; //// URL to layout folder $PBON=0;/// Set to 1 for use with photobucket $PBloc="http://000.photobucket.com/albums/q37/some-folder/";//// Photobucket url $path = $_SERVER["/home/fabu/public_html"]."/layout/"; //// Server path to layout folder $cats_per_row=6; //// Number of categories per nav row $t_cols=30;/// Textarea cols $t_rows=10;/// Textarea rows $thumb_h ="200"; ///thumb height $thumb_w ="250"; ///thumb width $default_cat ="Bling"; $ext = ".css"; ///css file extention IE: ".php" for MSRS layouts $items_per =5;///items per page. $show_ad=2;///show ad after so many layouts, edit your add via ad.php $l_header = './header.php'; //// Header File $l_footer = './footer.php'; //// Footer File ///////////////////////////////////////////////////////////////////////////// $layoutlist = file($path."data/layoutlist.txt"); $searchform = "<form method=\"get\" action =\"".$site_url."search.php\"><b>Layout Search:</b> <input type=\"text\" name=\"term\" size=\"30\"> <input type=\"submit\" value=\"Search Layouts\"></form>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649867 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 @wildteen: Wow, good catch. o_O @Riseykins: Try wildteen's code, and change <? to <?php whenever you see it. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649870 Share on other sites More sharing options...
wildteen88 Posted September 24, 2008 Share Posted September 24, 2008 DarkWater and jonsjava quit the snide comments. If you've got nothing useful/helpful to say don't reply. I will lock this thread if any more snide comments arise. @Riseykins watch the language too. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649874 Share on other sites More sharing options...
jonsjava Posted September 24, 2008 Share Posted September 24, 2008 actually I didn't notice. GAAHH! I need to stop doig 5 things at once. Sry, should have seen that. <?php $site_title = "EasyLayoutCMS"; //// Site title $url = "http://www.fabulayouts.com/layout/"; //// URL to layout folder $PBON=0;/// Set to 1 for use with photobucket $PBloc="http://000.photobucket.com/albums/q37/some-folder/";//// Photobucket url $path = "/home/fabu/public_html/layout/"; //// Server path to layout folder $cats_per_row=6; //// Number of categories per nav row $t_cols=30;/// Textarea cols $t_rows=10;/// Textarea rows $thumb_h ="200"; ///thumb height $thumb_w ="250"; ///thumb width $default_cat ="Bling"; $ext = ".css"; ///css file extention IE: ".php" for MSRS layouts $items_per =5;///items per page. $show_ad=2;///show ad after so many layouts, edit your add via ad.php $l_header = './header.php'; //// Header File $l_footer = './footer.php'; //// Footer File ///////////////////////////////////////////////////////////////////////////// $layoutlist = file($path."data/layoutlist.txt"); $searchform = "<form method=\"get\" action =\"".$site_url."search.php\">Layout Search: <input type=\"text\" name=\"term\" size=\"30\"> <input type=\"submit\" value=\"Search Layouts\"></form>"; ?> and in my defense. I wasn't being snide. I was trying to show him that we are helpful, and not to judge us by one comment. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649875 Share on other sites More sharing options...
DarkWater Posted September 24, 2008 Share Posted September 24, 2008 DarkWater and jonsjava quit the snide comments. If you've got nothing useful/helpful to say don't reply. I will lock this thread if any more snide comments arise. @darkfreaks watch the language too. I wasn't being snide at all... =/ If you really think that I meant to be derogatory with that remark, whatever, but I wasn't. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649877 Share on other sites More sharing options...
darkfreaks Posted September 24, 2008 Share Posted September 24, 2008 i don't think i used any rude language? but i will watch the remarks. but yes we are here to be helpful. i think my code is the most straight forward's or wild_teens Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649879 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 Sorry, guys. Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649881 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 http://www.fabulayouts.com/layout Merci! Thanks so much. The creator of the script couldn't help to save his life. :s Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649904 Share on other sites More sharing options...
Riseykins Posted September 24, 2008 Author Share Posted September 24, 2008 Could you guys help me with this part of the script, too? This is from three different files... <?php $gcount = $layoutlist; array_shift($gcount); echo "<br /><br /><p><b>We currently have <span style=\"text-decoration:underline;font-size:12pt;\">".count($gcount)."</span> MySpace layouts in this category!</b></p>"; ?> <?php $linkitems = 6; $per_cell = 3; $links = $layoutlist; array_shift($links); $countlisted = count($links); if($countlisted>$linkitems){ $rand_keys = array_rand($links, $linkitems); $i = 0; echo "<table width=\"100%\"><tr><td>"; while ($i <= $linkitems-1) { list($dir, $layout) = explode("/", $links[$rand_keys[$i]]); $layout = trim($layout); $layoutstrip = preg_replace('/[^a-zA-Z]/i', ' ', $layout); $dir = trim($dir); if($i % $per_cell ==0){ echo "</td><td>"; } echo "<a href=\"".$url."preview.php?cat=".$dir."&layout=".$layout."\" title=\"".$layout." layout\" target=\"_blank\">".ucfirst($layoutstrip)." Layout</a><br>\n"; $i++; } echo "</td></tr></table>"; } ?> <?php if($PBON == 1) $site_url = $PBloc; else $site_url = $url; $thumbitems = 4; $thumbs = $layoutlist; array_shift($thumbs); if(count($thumbs)>$thumbitems){ $rand_keys = array_rand($thumbs, $thumbitems); $i = 0; while ($i <= $thumbitems-1) { list($dir, $layout) = explode("/", $thumbs[$rand_keys[$i]]); $layout = trim($layout); $dir = trim($dir); echo "<a href=\"".$url."preview.php?cat=".$dir."&layout=".$layout."\" title=\"".$layout." layout\" target=\"_blank\"><img src=\"".$site_url."cat/".$dir."/".$layout."/thumb.jpg\" width=\"125\" height=\"100\" alt=\"".$layout." layout\" border=\"0\"></a>\n"; $i++; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/125679-solved-path-_serverdocument_rootlayout-server-path-to-layou/#findComment-649921 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.