| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read | ![]() |
|
||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Could you give us an example unknown? I'm not sure I get what you're asking - PHP shouldn't just move files from directory to directory (unless you're runnning a script that does that). Is it a paths problem so your specifying a path to another file and the paths are different depending upon the location of the original file.
Sorry that probably sounds like gibberish. Hi Ron - are you saying that you keep all of your pages (rather than parts of a page) in a database?
__________________
homo sum: humani nil a me alienum puto ... ( just Google it ) |
|
||||
|
lol Kev
its ok i understand .. atleast i think i do heres basically what i mean. I have home page "Home.php" within that page i would have the code <?php include 'menu.php'; ?> ok so thats templating thats the simple part where within home.php it will load menu.php but when i have i have a directory eg forums/ and within it i have and different php and stuff so what im saying is when i use <?php include 'forums/login.php'; ?> into Home.php it basically moves the php file so say within login.php it has <?php include 'system.php'; ?> so that would open forums/system.php because its in the directory but when i use it in Home.php it makes 'forums/login.php' into 'login.php' so when login.php wants to access system.php which is meant to be within the same directory it just opens "can not find 'system.php' " ummm yeah.. pretty confusing i tried to make it as simple as i could thanks -unknown4 PS Home.php is not in any directories. |
|
||||
|
I think I get it - I think this is a relative paths problem where if you want to include a header in all your files and it's in /includes it's ok to use the relative path from a file in the home directory but it gets more complicated if you are using relative paths from other subdirectories and then a real pain in the arse when you start using includes that also include other files.
Is that about right unky4? Or am i barking up the wrong tree?
__________________
homo sum: humani nil a me alienum puto ... ( just Google it ) |
|
|||
|
Take it easy unkown, just use GLOBAL VARIABLES to indicate your PATH and let them loaded from you DB, so everytime you change anything just change the VARIABLE's context at the DB and your problem will resolve and don't use your links like the form of http://.... but just like ./$GLOBAL_PATH/$TEMPLATE_PATH/...
Tell us what will happen after. |
|
|||
|
I did unkown , I don't need the concept , I need the exact code , some thing like this :
Code:
include "c:/wamp/www/cnstats/cnt.php";
if (!eregi("index.php", $_SERVER['SCRIPT_NAME'])) {
die ("Vous n'avez pas la permission d'ouvrir cette page seule...");
}
include ("./config/all.php");
echo $language ;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//FR">
<html>
<head>
<title>La Ligue National Du FootBall</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<?php
global $connection ;
$connection = Connecting() ;
//$db = mysql_select_db("lnfoot" , $connection) or die('there is no db with such a name');
session_start();
|
|
||||
|
All the codes i put into my site relating to this problem is right there...
Like I said, I entered nothing into any database, I havn't even created one
__________________
(\__/) (='.'=)This is Bunny. Copy and paste bunny into your (")_(")signature to help him gain world domination. |
|
|||
|
The only way i know of is to actually use full urls not relative paths.
I know it means changing all your links but can't see any other way. If you use dreamweaver you can do this automatically using the change link sitewide option. I use php for my included files, as in : ($_SERVER["DOCUMENT_ROOT"]."/includes/whatever_file.php") but in this day and age where it is preffered to have register globals turned OFF, it maybe more prudent to just use full urls |
|
|||
|
Quote:
1- Firs of all you should manage your templates dynamically and I can't make you examples with your explanations but I'll explain in other way. 2- Use one file to be shown on the URL, and the other pages are included as variables , let's take the simplest example and let's say I have a forum and a blog scripts: the forum's path is /home/forum the blog's path is /home/blog in this case we should redirect them like /home/forum/index.php , /home/forum/login.php , /home/forum/system.php and /home/blog/index.php , /home/blog/login.php ...etc but how about : Code:
/home/index.php?mod=forum&op=login , /home/index.php?mod=forum&op=sys Code:
/home/index.php?mod=blog&op=login Code:
$mod = $_GET['mod'] ; $op = $_GET['op'] ; FuncSwitchEx($mod , $op) ; Code:
function FuncSwitch($mod , $op , $VldDel)
{
switch ($mod)
{
case forum:
switch ($op)
{
case login:
include ("./modules/forum/login.php") ;
break ;
case sys:
include ("./modules/forum/system.php");
break ;
default:
include ("./modules/forum/index.php");
break ;
}
break ;
case blog:
switch ($op)
{
case login:
include ("./modules/blog/login.php");
break;
default:
include ("./modules/blog/index.php");
break;
}
break ;
HEADER LEFT MENU BODY RIGHT MENU FOOTER and just cut them using Code:
<TABLE> If we want to get more pro we have to add a dynamic path function , it's simple by adding global variables like these : $_HOME_PATH , $_MODULES_PATH ...etc and put all our scripts as modules , so Forum will be just a module and so is Blog. This way neither your menus will be displaced nor you have to change your links every time. And there are more and more things you have to do , but it's good to start with like that. Good luck buddy and don't get angry I was looking for your own script to tell you exactly what to do , but I think this one would help ,Have a nice day ![]() Last edited by ouahabix; 05-04-2007 at 02:30 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|