fallenone1884 Posted September 12, 2006 Share Posted September 12, 2006 Im trying to update my site using php, so learning as i go with simple functions and scripts, i have a question regarding a URL variable get command (think thats what its called)The majority of the code works fine with no problems, issues i am having are when i try and get from another directory, or when calling on a php script like phpbb2.right now i have my page seperated into two frames, one which i use for the link menu and banner image and the "body" frame which i direct all my links to.I would like to keep this setup, but want to get rid of the frames, most of the url variable get functions work correctly. its just when i try and get something that resides in another directory, or as i said above something like phpbb2. i tried a work around for the forum issue with phpbb2 making a forum.php file and doing an include in that file and using the url variable to call thatwww.myhost.com/index.php?page=forumand it will pull the page up, and place it in the body, but the style is gone, aas well as any images ect...I dont know if ive been clear or just rambled, let me know, i would like to see this work, or some idea's on how to handle this situation.Thanks Quote Link to comment Share on other sites More sharing options...
btherl Posted September 12, 2006 Share Posted September 12, 2006 A little rambly :) I'll try to clarify some thingsCan you give more detail about what "get from another directory" means? Are you talking about forms, eg <form method=get>, or about links, eg <a href="page.php?var=value">? Or something else?Also, are you using cookies or sessions (or neither)? Quote Link to comment Share on other sites More sharing options...
fallenone1884 Posted September 12, 2006 Author Share Posted September 12, 2006 This is the coding i would like to use and is what i mean by the get function [code]$p = $_GET["page"];[/code]im not using cookies or sessionsand as i said, it will load the php pages that reside in the same dir. as the code below, well i beleive it will load any directory as long as i type it that way[code]www.myhost.com/index.php?page=pages/hello/mine/gold[/code]like abovebut its not loading the images ect along with the content, as i can see the image paths are getting lost or rather being changed to the url of the path of this scriptso instead of myhost.com/forum/picturesits making it myhost.com/picturesand then none of the links work in the forum, because i am assuming, they are no longer relative to the current path[code]<?php require "fcbanner.php";require "menu.php";?><?php$p = $_GET["page"];if (strpos($p,"..")) { die("Bad page request");}if (!$p) $p = "main2";$content_file=$_SERVER["DOCUMENT_ROOT"]."/".$p.".php";if (!file_exists($content_file)) { header("Location: {$_SERVER["PHP_SELF"]}"); exit();}// Syntax: $variable = (condition) ? value_if_true : value_if_false;$title = ($p) ? "$p - Fated Chaos" : "Main page - Fated Chaos";include("header.php");include($content_file);include("footer.php");?> <?phpinclude("http://www.fatedchaos.com/Forum/index.php");include("http://www.fatedchaos.com/counter/phpcounter.php");include("webring.php"); include("copyright.php"); ?>[/code] Quote Link to comment 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.